OLD | NEW |
| 1 CONSOLE ERROR: line 1: ConstraintError: Key already exists in the object store. |
| 2 CONSOLE ERROR: line 1: ConstraintError: Key already exists in the object store. |
1 Verify that a transaction with an error aborts unless preventDefault() is called
. | 3 Verify that a transaction with an error aborts unless preventDefault() is called
. |
2 | 4 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 5 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 6 |
5 | 7 |
6 dbname = "error-causes-abort-by-default.html" | 8 dbname = "error-causes-abort-by-default.html" |
7 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
8 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
9 setVersionSuccess(): | 11 setVersionSuccess(): |
10 trans = event.target.transaction | 12 trans = event.target.transaction |
11 PASS trans is non-null. | 13 PASS trans is non-null. |
12 db.createObjectStore('storeName', null) | 14 db.createObjectStore('storeName', null) |
| 15 |
| 16 Test: prevent the default event behavior prevents the transaction from aborting |
13 trans = db.transaction(['storeName'], 'readwrite') | 17 trans = db.transaction(['storeName'], 'readwrite') |
14 trans.onabort = unexpectedAbortCallback | 18 trans.onabort = unexpectedAbortCallback |
15 trans.oncomplete = transactionCompleted | 19 trans.oncomplete = transactionCompleted |
16 store = trans.objectStore('storeName') | 20 store = trans.objectStore('storeName') |
17 store.add({x: 'value', y: 'zzz'}, 'key') | 21 store.add({x: 'value', y: 'zzz'}, 'key') |
18 event.target.source.add({x: 'value', y: 'zzz'}, 'key') | 22 event.target.source.add({x: 'value', y: 'zzz'}, 'key') |
19 event.preventDefault() | 23 event.preventDefault() |
20 PASS Transaction completed | 24 PASS Transaction completed |
21 | 25 |
22 | 26 Test: allowing the default event behavior, which aborts the transaction |
23 trans = db.transaction(['storeName'], 'readwrite') | 27 trans = db.transaction(['storeName'], 'readwrite') |
24 trans.onabort = transactionAborted1 | 28 trans.onabort = transactionAborted1 |
25 trans.oncomplete = unexpectedCompleteCallback | 29 trans.oncomplete = unexpectedCompleteCallback |
26 store = trans.objectStore('storeName') | 30 store = trans.objectStore('storeName') |
27 store.add({x: 'value', y: 'zzz'}, 'key') | 31 store.add({x: 'value', y: 'zzz'}, 'key') |
28 Doing nothing to prevent the default action... | 32 Doing nothing to prevent the default action... |
29 PASS Transaction aborted | 33 PASS Transaction aborted |
30 | 34 |
31 | 35 Test: no error handler implicitly allows allowing the default event behavior, wh
ich aborts the transaction |
32 trans = db.transaction(['storeName'], 'readwrite') | 36 trans = db.transaction(['storeName'], 'readwrite') |
33 trans.onabort = transactionAborted2 | 37 trans.onabort = transactionAborted2 |
34 trans.oncomplete = unexpectedCompleteCallback | 38 trans.oncomplete = unexpectedCompleteCallback |
35 store = trans.objectStore('storeName') | 39 store = trans.objectStore('storeName') |
36 store.add({x: 'value', y: 'zzz'}, 'key') | 40 store.add({x: 'value', y: 'zzz'}, 'key') |
37 Omitting an onerror handler | 41 Omitting an onerror handler on request; transaction should abort |
38 PASS Transaction aborted | 42 PASS Transaction aborted |
39 PASS successfullyParsed is true | 43 PASS successfullyParsed is true |
40 | 44 |
41 TEST COMPLETE | 45 TEST COMPLETE |
42 | 46 |
OLD | NEW |