OLD | NEW |
1 Test IndexedDB transaction rollback. | 1 Test IndexedDB transaction rollback. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | |
7 | |
8 dbname = "transaction-rollback.html" | 6 dbname = "transaction-rollback.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 db.createObjectStore('myObjectStore') | 9 db.createObjectStore('myObjectStore') |
12 PASS db.objectStoreNames.length is 1 | 10 PASS db.objectStoreNames.length is 1 |
13 setVersionComplete(): | 11 setVersionComplete(): |
14 transaction = db.transaction(['myObjectStore'], 'readwrite') | 12 transaction = db.transaction(['myObjectStore'], 'readwrite') |
15 store = transaction.objectStore('myObjectStore') | 13 store = transaction.objectStore('myObjectStore') |
16 store.add('rollbackValue', 'rollbackKey123') | 14 store.add('rollbackValue', 'rollbackKey123') |
17 addSuccess(): | 15 addSuccess(): |
18 PASS event.target.result is "rollbackKey123" | 16 PASS event.target.result is "rollbackKey123" |
19 store.openCursor() | 17 store.openCursor() |
20 openCursorSuccess(): | 18 openCursorSuccess(): |
21 cursor = event.target.result | 19 cursor = event.target.result |
22 abortCallback(): | 20 abortCallback(): |
23 Transaction was aborted. | 21 Transaction was aborted. |
24 transaction = db.transaction(['myObjectStore'], 'readonly') | 22 transaction = db.transaction(['myObjectStore'], 'readonly') |
25 store = transaction.objectStore('myObjectStore') | 23 store = transaction.objectStore('myObjectStore') |
26 store.get('rollbackKey123') | 24 store.get('rollbackKey123') |
27 getSuccess(): | 25 getSuccess(): |
28 PASS event.target.result is undefined | 26 PASS event.target.result is undefined |
29 PASS cursor.value is "rollbackValue" | 27 PASS cursor.value is "rollbackValue" |
30 PASS successfullyParsed is true | 28 PASS successfullyParsed is true |
31 | 29 |
32 TEST COMPLETE | 30 TEST COMPLETE |
33 | 31 |
OLD | NEW |