blob: e7b42e879e92093944bd8539687a4502f3c9e6a4 [file] [log] [blame]
Test transaction aborts send the proper onabort messages..
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "transaction-abort.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('storeName', null)
store.add({x: 'value', y: 'zzz'}, 'key')
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted
trans.oncomplete = unexpectedCompleteCallback
store = trans.objectStore('storeName')
store.add({x: 'value2', y: 'zzz2'}, 'key2')
store.add({x: 'value3', y: 'zzz3'}, 'key3')
PASS event.target.error.name is 'AbortError'
PASS trans.error is null
PASS firstError is false
PASS secondError is false
PASS abortFired is false
Expecting exception from store.add({x: 'value4', y: 'zzz4'}, 'key4')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction has finished.
PASS event.target.error.name is 'AbortError'
PASS trans.error is null
PASS firstError is true
PASS secondError is false
PASS abortFired is false
PASS firstError is true
PASS secondError is true
PASS abortFired is false
PASS trans.error is null
Expecting exception from store.add({x: 'value5', y: 'zzz5'}, 'key5')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction has finished.
Expecting exception from trans.abort()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'abort' on 'IDBTransaction': The transaction has finished.
PASS successfullyParsed is true
TEST COMPLETE