Test that a database is recreated correctly when an open-with-version call is queued behind a deleteDatabase call
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "intversion-gated-on-delete.html"
indexedDB.deleteDatabase(dbname)
deleteSuccess():
request = indexedDB.open(dbname)
request.onsuccess = firstSuccessCallback
firstSuccessCallback():
connection1 = event.target.result
connection1.onversionchange = connection1VersionChangeCallback
request = indexedDB.open(dbname)
request.onsuccess = secondSuccessCallback
request = indexedDB.deleteDatabase(dbname)
request.onblocked = deleteDatabaseBlockedCallback
request.onsuccess = deleteDatabaseSuccessCallback
request = indexedDB.open(dbname, 1)
request.onupgradeneeded = upgradeNeededCallback
request.onsuccess = openWithVersionSuccessCallback
secondSuccessCallback():
db = event.target.result
db.onversionchange = connection2VersionChangeCallback
connection1VersionChangeCallback():
PASS event.type is "versionchange"
PASS event.oldVersion is 1
PASS event.newVersion is null
connection2VersionChangeCallback():
PASS event.type is "versionchange"
event.target.close()
deleteDatabaseBlockedCallback():
connection1.close()
deleteDatabaseSuccessCallback():
upgradeNeededCallback():
PASS event.newVersion is 1
PASS event.oldVersion is 0
openWithVersionSuccessCallback():
PASS event.target.result.objectStoreNames.length is 0
PASS successfullyParsed is true
TEST COMPLETE