blob: aeed015552e1e99fb3098f679992f770ea233d3c [file] [log] [blame]
Test event propogation on IDBTransaction.
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)
store = db.createObjectStore('storeName', null)
store.add({x: 'value', y: 'zzz'}, 'key')
Verifing abort
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = abortFiredCallback
trans.oncomplete = unexpectedAbortCallback
db.addEventListener('abort', dbAbortCaptureCallback, true)
db.addEventListener('abort', dbAbortBubbleCallback, false)
db.addEventListener('complete', unexpectedCompleteCallback, true)
db.addEventListener('complete', unexpectedCompleteCallback, false)
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
In IDBDatabase abort capture
PASS dbCaptureFired is false
PASS abortFired is false
PASS dbBubbleFired1 is false
PASS event.target is trans
PASS event.currentTarget is db
In abort handler
PASS dbCaptureFired is true
PASS abortFired is false
PASS dbBubbleFired1 is false
PASS event.target is trans
PASS event.currentTarget is trans
In IDBDatabase error bubble
PASS dbCaptureFired is true
PASS abortFired is true
PASS dbBubbleFired1 is false
PASS event.target is trans
PASS event.currentTarget is db
Verifing success.
trans = db.transaction(['storeName'], 'readwrite')
trans.oncomplete = completeFiredCallback
trans.onabort = unexpectedAbortCallback
db.removeEventListener('abort', dbAbortCaptureCallback, true)
db.removeEventListener('abort', dbAbortBubbleCallback, false)
db.removeEventListener('complete', unexpectedCompleteCallback, true)
db.removeEventListener('complete', unexpectedCompleteCallback, false)
db.addEventListener('complete', dbCompleteCaptureCallback, true)
db.addEventListener('complete', dbCompleteBubbleCallback, false)
db.addEventListener('abort', unexpectedAbortCallback, true)
db.addEventListener('abort', unexpectedAbortCallback, false)
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key2')
In IDBDatabase complete capture
PASS dbCaptureFired is false
PASS completeFired is false
PASS dbBubbleFired2 is false
PASS event.target is trans
PASS event.currentTarget is db
In IDBRequest handler
PASS dbCaptureFired is true
PASS completeFired is false
PASS dbBubbleFired2 is false
PASS event.target is trans
PASS event.currentTarget is trans
PASS successfullyParsed is true
TEST COMPLETE