使用indexedDB时出现错误"操作失败,因为无法找到所请求的数据库对象..."

Dun*_*yne 5 firefox html5 indexeddb

我们正在构建一个在Firefox上广泛使用IndexedDB来存储离线数据的应用程序.

这在大多数情况下运行良好,但偶尔会因以下错误而失败:

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)"
Run Code Online (Sandbox Code Playgroud)

它似乎在代码中的各个地方都失败了; 这是罪魁祸首之一:

_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
Run Code Online (Sandbox Code Playgroud)

令我困惑的是,在通常有效的自动化测试期间,故障很少发生(我们在每次数百次执行中都会看到其中一次失败).

值得一提的是,我们也存储了大量数据,大约数百兆字节.原来自动测试只存储几兆字节,所以这不是一个大小问题.

有没有其他人经历过(或者更好,有经验和固定!)这个问题?

Dun*_*yne 5

这似乎是一个 Firefox 错误。我提出了错误 751802 - 间歇性 IndexedDB 写入失败,我和我的同事正忙于与 Firefox 人员合作以帮助重现它。

目前没有解决方法或修复方法。