blob: 4d09a008d7218de4ef8cd69739e81b474e28151f [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".
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
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 store record in an IDBObjectStore: The transaction is inactive or 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 store record in an IDBObjectStore: The transaction is inactive or 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 is inactive or finished.
PASS successfullyParsed is true
TEST COMPLETE