blob: 4f3a78c24ebffa12748f430fc8681a4a31190543 [file] [log] [blame]
Check that readwrite transactions with overlapping scopes do not 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)
openConnection1():
indexedDB.open(dbname, 1)
openOnUpgradeNeeded1():
db = event.target.result
store = db.createObjectStore('store')
openOnSuccess():
db1 = event.target.result
openConnection2():
indexedDB.open(dbname, 1)
openOnSuccess2():
db2 = event.target.result
startWork():
transaction1 = db1.transaction('store', 'readwrite')
transaction2 = db2.transaction('store', 'readwrite')
transaction1PutSuccess = false
transaction1Complete = false
transaction2PutSuccess = false
transaction2Complete = false
Keep transaction1 alive for a while and ensure transaction2 doesn't start
count = 0
transaction1.objectStore('store').put(1, count++)
transaction2.objectStore('store').put(2, 0)
put1OnSuccess():
transaction1PutSuccess = true
transaction1.objectStore('store').put(1, count++)
put1OnSuccess():
transaction1PutSuccess = true
transaction1.objectStore('store').put(1, count++)
put1OnSuccess():
transaction1PutSuccess = true
transaction1.objectStore('store').put(1, count++)
put1OnSuccess():
transaction1PutSuccess = true
transaction1.objectStore('store').put(1, count++)
put1OnSuccess():
transaction1PutSuccess = true
onTransaction1Complete():
transaction1Complete = true
PASS transaction2PutSuccess is false
PASS transaction2Complete is false
put2OnSuccess():
transaction2PutSuccess = true
PASS transaction1Complete is true
onTransaction2Complete():
transaction2Complete = true
PASS transaction1PutSuccess is true
PASS transaction1Complete is true
PASS transaction2PutSuccess is true
PASS successfullyParsed is true
TEST COMPLETE