48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
Test that an aborted 'versionchange' transaction closes the connection.
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
|
|
|
|
indexedDB.deleteDatabase(dbname)
|
|
indexedDB.open(dbname, 1)
|
|
|
|
prepareDatabase():
|
|
db = event.target.result
|
|
db.createObjectStore('store')
|
|
|
|
onOpen():
|
|
db = event.target.result
|
|
db.close()
|
|
|
|
openAgain():
|
|
request = indexedDB.open(dbname, 2)
|
|
|
|
onUpgradeNeeded():
|
|
db = event.target.result
|
|
transaction = event.target.transaction
|
|
sawTransactionAbort = false
|
|
|
|
onTransactionAbort():
|
|
sawTransactionAbort = true
|
|
creating a transaction should fail because connection is closed:
|
|
Expecting exception from db.transaction('store')
|
|
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.
|
|
|
|
onOpenError():
|
|
PASS sawTransactionAbort is true
|
|
creating a transaction should fail because connection is closed:
|
|
Expecting exception from db.transaction('store')
|
|
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.
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|