59 lines
1.5 KiB
Plaintext
59 lines
1.5 KiB
Plaintext
Check that scope restrictions on read-write transactions are enforced.
|
|
|
|
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
|
|
db.createObjectStore('a')
|
|
db.createObjectStore('b')
|
|
db.createObjectStore('c')
|
|
|
|
runTransactions():
|
|
db = event.target.result
|
|
|
|
transaction1 = db.transaction(['a'], 'readwrite')
|
|
transaction1Started = false
|
|
transaction1Complete = false
|
|
transaction1.objectStore('a').get(0)
|
|
|
|
transaction2 overlaps with transaction1, so must wait until transaction1 completes
|
|
transaction2 = db.transaction(['a', 'b'], 'readwrite')
|
|
transaction2Started = false
|
|
transaction2Complete = false
|
|
transaction2.objectStore('a').get(0)
|
|
|
|
transaction3 overlaps with transaction2, so must wait until transaction2 completes
|
|
even though it does not overlap with transaction1
|
|
transaction3 = db.transaction(['b', 'c'], 'readwrite')
|
|
transaction3Started = false
|
|
transaction3Complete = false
|
|
transaction3.objectStore('b').get(0)
|
|
|
|
transaction1Started = true
|
|
|
|
transaction1Complete = true
|
|
PASS transaction2Started is false
|
|
PASS transaction3Started is false
|
|
|
|
PASS transaction1Complete is true
|
|
transaction2Started = true
|
|
|
|
transaction2Complete = true
|
|
PASS transaction3Started is false
|
|
|
|
PASS transaction1Complete is true
|
|
PASS transaction2Complete is true
|
|
transaction3Started = true
|
|
|
|
transaction3Complete = true
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|