OLD | NEW |
1 Check that read-only transactions within a database can run in parallel. | 1 Check that read-only transactions within a database can run in parallel. |
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-coordination-within-database.html" | 6 dbname = "transaction-coordination-within-database.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 | 9 |
12 prepareDatabase(): | 10 prepareDatabase(): |
13 db = event.target.result | 11 db = event.target.result |
14 store = db.createObjectStore('store') | 12 store = db.createObjectStore('store') |
15 store.put('value', 'key') | 13 store.put('value', 'key') |
16 | 14 |
17 runParallelTransactions(): | 15 runParallelTransactions(): |
18 db = event.target.result | 16 db = event.target.result |
19 | 17 |
20 transaction1 = db.transaction('store', 'readonly') | 18 transaction1 = db.transaction('store', 'readonly') |
21 transaction2 = db.transaction('store', 'readonly') | 19 transaction2 = db.transaction('store', 'readonly') |
22 transaction1GetSuccess = false | 20 transaction1GetSuccess = false |
23 transaction2GetSuccess = false | 21 transaction2GetSuccess = false |
24 Keep both transactions alive until each has reported at least one successful ope
ration | 22 Keep both transactions alive until each has reported at least one successful ope
ration |
25 | 23 |
26 onTransactionComplete(): | 24 onTransactionComplete(): |
27 first transaction complete, still waiting... | 25 first transaction complete, still waiting... |
28 | 26 |
29 onTransactionComplete(): | 27 onTransactionComplete(): |
30 PASS transaction1GetSuccess is true | 28 PASS transaction1GetSuccess is true |
31 PASS transaction2GetSuccess is true | 29 PASS transaction2GetSuccess is true |
32 db.close() | 30 db.close() |
33 PASS successfullyParsed is true | 31 PASS successfullyParsed is true |
34 | 32 |
35 TEST COMPLETE | 33 TEST COMPLETE |
36 | 34 |
OLD | NEW |