blob: 30cd74db2eeabf543b2ff5e38bd2b5fae0561f71 [file] [log] [blame]
Test exceptions in IDBRequest handlers cause aborts.
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 = transactionAborted1
trans.oncomplete = unexpectedCompleteCallback
store = trans.objectStore('storeName')
store.add({x: 'value2', y: 'zzz2'}, 'key2')
event.preventDefault()
Throwing
PASS Got expected error: 'this exception is expected'
PASS The transaction was aborted.
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted2
trans.oncomplete = unexpectedCompleteCallback
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
event.preventDefault()
Throwing
PASS Got expected error: 'this exception is expected'
PASS The transaction was aborted.
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = unexpectedAbortCallback
trans.oncomplete = transactionCompleted1
store = trans.objectStore('storeName')
store.add({x: 'value3', y: 'zzz3'}, 'key3')
event.preventDefault()
Throwing within a try block
PASS The transaction completed.
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = unexpectedAbortCallback
trans.oncomplete = transactionCompleted2
store = trans.objectStore('storeName')
store.add({x: 'value4', y: 'zzz4'}, 'key4')
PASS key4 added
PASS The transaction completed.
PASS successfullyParsed is true
TEST COMPLETE