The database cannot be closed if transactions are still running, so itβs possible. Do you have something like this?
IndexedDB.open("mydb").onsuccess = function(e) { db = e.target.result; trans = db.transaction("someobjectstore"); os = trans.getObjectStore("someobjectstore"); os.put("blah"); db.close(); }
If so, the transaction may still be running.
No matter what, the database will still be deleted if you receive a blocked event ... when all connections to it are closed.
When you create a database connection, make sure you assign the onversionchange handler to the resulting db. This can help debug what happens.
IndexedDB.open("mydb").onsuccess = function(e) { db = e.target.result; db.onversionchange = function(e) { console.log("got versionchange event: " + e); } trans = db.transaction("someobjectstore"); os = trans.getObjectStore("someobjectstore"); os.put("blah"); db.close(); }
source share