The error "Operation failed because the requested database object was not found ..." when using indexedDB

We are creating an application that makes extensive use of IndexedDB for Firefox to store offline data.

This works well in most cases, but sometimes with errors such as:

Exception... "The operation failed because the requested database object could 
not be found. For example, an object store did not exist but was being opened."  
code: "3" nsresult: "0x80660003 (NS_ERROR_DOM_INDEXEDDB_NOT_FOUND_ERR)"

It doesn't seem to work in different places in the code; here is one of the culprits:

_writePage: (storeName, startIndex, endIndex, binder) ->
  writeTransaction = @connection.transaction([storeName], @idbTransaction.READ_WRITE)
  store = writeTransaction.objectStore(storeName)
  for index in [startIndex...endIndex] when (item = binder.list[index])?
    writeRequest = store.put(item)
    writeRequest.onerror = binder.failCallback()
    writeRequest.onsuccess = binder.successCallback()
  if endIndex >= binder.list.length
    binder.finishedRegisteringCallbacks()
    return
  setTimeout((=> @_writePage(storeName, endIndex, endIndex + @WRITE_EACH_PAGE_SIZE, binder)), @WRITE_EACH_PAGE_DELAY)
  null

What puzzles me is that errors occur infrequently during automated tests that usually work (we observe one of these failures for hundreds of executions).

It is worth mentioning that we also store a lot of data in the amount of hundreds of megabytes. It turns out that automatic tests contain only a few megabytes, so this is not a matter of size.

Has anyone else experienced (or better yet, tested and fixed!) This problem?

+5
3
+1

, , . setVersion ( API) onupgradedneeded ( API), , , .

, onblocked (vs. onerror) .

0

Adding to @Duncan's answer:

There is an idea in this thread to throw catch in db create / open

https://bugzilla.mozilla.org/show_bug.cgi?id=751802#ch-8

0
source

All Articles