44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
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;
|
|
|
|
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
|
|
|