blob: 22b1b9f9ee1fb9d8d4c855a496b62c33ec9ea9cb [file] [log] [blame]
Verify that a transaction with an error aborts unless preventDefault() is called.
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;
dbname = "error-causes-abort-by-default.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
setVersionSuccess():
trans = event.target.transaction
PASS trans is non-null.
db.createObjectStore('storeName', null)
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = unexpectedAbortCallback
trans.oncomplete = transactionCompleted
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
event.target.source.add({x: 'value', y: 'zzz'}, 'key')
event.preventDefault()
PASS Transaction completed
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted1
trans.oncomplete = unexpectedCompleteCallback
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
Doing nothing to prevent the default action...
PASS Transaction aborted
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted2
trans.oncomplete = unexpectedCompleteCallback
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
Omitting an onerror handler
PASS Transaction aborted
PASS successfullyParsed is true
TEST COMPLETE