12

I'm using IndexedDB to store some data. It appears to work, but if I refresh the page, I see: An IndexedDB transaction that was not yet complete has been aborted due to page navigation. in the browser console on Firefox (36.0.4). I'm using this (local) file to test:

<html>
  <head><meta charset="UTF-8"></head>
  <body>
    <script>
var request = window.indexedDB.open("test_db", 2);
request.onupgradeneeded = function (event) {
  request.result.createObjectStore("test_store");
};

request.onsuccess = function (event) {
  var db = request.result;
  var transaction = db.transaction(["test_store"], "readwrite");
  var put = transaction.objectStore("test_store").put("key", "value");
  transaction.oncomplete = function (event) {
    console.log("Transaction complete");
  };
};
    </script>
  </body>
</html>

If I perform multiple transactions, I get multiple errors. If I have an onclick handler that performs a transaction and I click it several times, refreshing prints one error for each transaction I made in the past.

All this makes me think my transactions aren't being cleaned up. What do I need to do to finish a transaction?

My oncomplete handler is being called. Refreshing a few times, the browser console looks like this:

"Transaction complete" test.html:16:1
An IndexedDB transaction that was not yet complete has been aborted due to page navigation. test.html:13:0
"Transaction complete" test.html:16:1
An IndexedDB transaction that was not yet complete has been aborted due to page navigation. test.html:13:0
"Transaction complete" test.html:16:1

Test page (Ctrl-Shift-J to open console, then Ctrl-R to refresh shows the error):

http://test.roscidus.com/static/idb.html

Thomas Leonard
  • 7,068
  • 2
  • 36
  • 40

1 Answers1

1

The error was a bug in Firefox, and now it's already fixed:

Status: RESOLVED FIXED

The fix was done on Firefox 41, which was released on Sep 22th 2015.

Tracking Flags: status-firefox41: fixed

Buzinas
  • 11,597
  • 2
  • 36
  • 58