- From: malibuzios <notifications@github.com>
- Date: Mon, 21 Mar 2016 01:44:57 -0700
- To: w3c/IndexedDB <IndexedDB@noreply.github.com>
- Message-ID: <w3c/IndexedDB/issues/72/199179272@github.com>
Thanks for the quick response! I tried to isolate the simplest test case I could to reproduce the "operation blocked" errors on IE11. It turns out I stumbled upon another unexpected phenomenon, that may or not be related to the particular issue but seems to also happen in Chrome and Edge as well (but interestingly not in Firefox). The following reduced test case does actually work, but surprisingly both the "blocked", "upgradeneeded" and "success" are triggered on each iteration, on Chrome, Edge and IE11 (in Firefox "blocked" is not triggered but it does succeed): ```js var lotsOfData = []; for (var i = 0; i < 10000; i++) lotsOfData.push({ prop1: 23523523, prop2: "abcdefghijklmnopqrstuvwxyz"}); var dbName = "bugtesting-" + Date.now(); var version = 1; function openAndMutateDB() { var request = window.indexedDB.open(dbName, version); request.onerror = function(event) { console.log("Iteration " + version + " triggered an error event!"); }; request.onblocked = function(event) { console.log("Iteration " + version + " triggered an operationblocked event!"); }; request.onupgradeneeded = function(event) { console.log("Iteration " + version + " triggered an onupgradeneeded event!"); var db = event.target.result; // Create a new object store named as the current version number var objectStore = db.createObjectStore(version.toString()); } request.onsuccess = function(event) { console.log("Iteration " + version + " triggered a success event!"); var db = event.target.result; // Create a lengthy put transaction and ignore its completion or failure events var objectStore = db.transaction(version.toString(), "readwrite").objectStore(version.toString()); objectStore.put(lotsOfData, "testRecord"); // Abruptly close the connection db.close(); // Increment the version variable version++; if (version <= 20) openAndMutateDB(); // Continue to reopen the database with a new connection else window.indexedDB.deleteDatabase(dbName); // Delete the database } } openAndMutateDB(); ``` Removing `db.close();` seems to cause all browsers to only trigger the `blocked` event and stop. How does this behavior relate to the spec? If "blocked" is triggered, why does the execution continue? Should the event be ignored at this case? (assuming that is even possible?). --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/IndexedDB/issues/72#issuecomment-199179272
Received on Monday, 21 March 2016 08:45:30 UTC