• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Verify that a transaction with an error aborts unless preventDefault() is called.
2
3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6webkitIndexedDB.open('error-causes-abort-by-default')
7db = event.target.result
8db.setVersion('new version')
9setVersionSuccess():
10trans = event.target.result
11PASS trans !== null is true
12trans.oncomplete = addData
13Deleted all object stores.
14db.createObjectStore('storeName', null)
15trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
16trans.onabort = unexpectedAbortCallback
17trans.oncomplete = transactionCompleted
18store = trans.objectStore('storeName')
19store.add({x: 'value', y: 'zzz'}, 'key')
20event.target.source.add({x: 'value', y: 'zzz'}, 'key')
21event.preventDefault()
22PASS Transaction completed
23
24
25trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
26trans.onabort = transactionAborted1
27trans.oncomplete = unexpectedCompleteCallback
28store = trans.objectStore('storeName')
29store.add({x: 'value', y: 'zzz'}, 'key')
30Doing nothing to prevent the default action...
31PASS Transaction aborted
32
33
34trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
35trans.onabort = transactionAborted2
36trans.oncomplete = unexpectedCompleteCallback
37store = trans.objectStore('storeName')
38store.add({x: 'value', y: 'zzz'}, 'key')
39Omitting an onerror handler
40PASS Transaction aborted
41PASS successfullyParsed is true
42
43TEST COMPLETE
44
45