36 lines
970 B
Plaintext
36 lines
970 B
Plaintext
Check that read-only transactions within a database 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;
|
|
|
|
indexedDB.deleteDatabase(dbname)
|
|
indexedDB.open(dbname)
|
|
|
|
prepareDatabase():
|
|
db = event.target.result
|
|
store = db.createObjectStore('store')
|
|
store.put('value', 'key')
|
|
|
|
runParallelTransactions():
|
|
db = event.target.result
|
|
|
|
transaction1 = db.transaction('store', 'readonly')
|
|
transaction2 = db.transaction('store', 'readonly')
|
|
transaction1GetSuccess = false
|
|
transaction2GetSuccess = false
|
|
Keep both transactions alive until each has reported at least one successful operation
|
|
|
|
onTransactionComplete():
|
|
first transaction complete, still waiting...
|
|
|
|
onTransactionComplete():
|
|
PASS transaction1GetSuccess is true
|
|
PASS transaction2GetSuccess is true
|
|
db.close()
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|