blob: 5f85c81d0a60721bd67a32e2b2d337bea776ddcc [file] [log] [blame]
Test event propogation on IDBTransaction.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
webkitIndexedDB.open('transaction-event-propagation')
db = event.target.result
db.setVersion('new version')
trans = event.target.result
PASS trans !== null is true
trans.oncomplete = startTest
Deleted all object stores.
store = db.createObjectStore('storeName', null)
store.add({x: 'value', y: 'zzz'}, 'key')
Verifing abort
trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
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([], webkitIDBTransaction.READ_WRITE)
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