I don't understand why this function was moved.  With the code like this, we have enumerateNextStorage() which uses onerror and onsuccess, but one of those functions is defined above it and one below it.  Can't you put onerror back where it was?  Or move onsuccess up to be near onerror?