| Check that transactions in different databases can run in parallel. |
| |
| 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; |
| |
| dbname1 = dbname + '1' |
| dbname2 = dbname + '2' |
| |
| deleteDatabase1(): |
| indexedDB.deleteDatabase(dbname1) |
| |
| deleteDatabase2(): |
| indexedDB.deleteDatabase(dbname2) |
| |
| openDatabase1(): |
| indexedDB.open(dbname1, 1) |
| |
| openOnUpgradeNeeded1(): |
| db1 = event.target.result |
| store1 = db1.createObjectStore('store') |
| store1.put(0, 0) |
| |
| openOnSuccess1(): |
| db1 = event.target.result |
| |
| openDatabase2(): |
| indexedDB.open(dbname2, 1) |
| |
| onUpgradeNeeded2(): |
| db2 = event.target.result |
| store2 = db2.createObjectStore('store') |
| |
| openOnSuccess2(): |
| db2 = event.target.result |
| |
| startWork(): |
| transaction1 = db1.transaction('store', 'readwrite') |
| transaction2 = db2.transaction('store', 'readwrite') |
| transaction1PutSuccess = false |
| transaction2PutSuccess = false |
| Keep both transactions alive until each has reported at least one successful operation |
| |
| onTransactionComplete(): |
| first transaction complete, still waiting... |
| |
| onTransactionComplete(): |
| PASS transaction1PutSuccess is true |
| PASS transaction2PutSuccess is true |
| db1.close() |
| db2.close() |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |