Test closing a database connection in IndexedDB.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "transaction-after-close.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store')
request = store.put('x', 'y')
PASS Put success
running first transaction
currentTransaction = db.transaction(['store'], 'readwrite')
objectStore.put('a', 'b')
db.close()
Expecting exception from db.transaction(['store'], 'readwrite')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
verify that we can reopen the db after calling close
indexedDB.open(dbname)
second_db = event.target.result
currentTransaction = second_db.transaction(['store'], 'readwrite')
request = store.put('1', '2')
PASS final put success
PASS successfullyParsed is true
TEST COMPLETE