blob: 8b7cb937c6b50481249b0934c591eb3a2fc554ff [file] [log] [blame]
Test event propogation on IDBRequest.
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')
Verify that handler fires and that not preventing default will result in an abort
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted
trans.oncomplete = unexpectedCompleteCallback
trans.onerror = allowDefault
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
PASS Event handler fired
Doing nothing to prevent the default action...
PASS handlerFired is true
Verifing error
trans = db.transaction(['storeName'], 'readwrite')
trans.onabort = transactionAborted2
trans.oncomplete = unexpectedAbortCallback
trans.addEventListener('error', errorCaptureCallback, true)
trans.addEventListener('error', errorBubbleCallback, false)
trans.addEventListener('success', unexpectedSuccessCallback, true)
trans.addEventListener('success', unexpectedSuccessCallback, false)
db.addEventListener('error', dbErrorCaptureCallback, true)
db.addEventListener('error', dbErrorBubbleCallback, false)
db.addEventListener('success', unexpectedSuccessCallback, true)
db.addEventListener('success', unexpectedSuccessCallback, false)
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key')
In IDBDatabase error capture
PASS dbCaptureFired is false
PASS captureFired is false
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is db
In IDBTransaction error capture
PASS dbCaptureFired is true
PASS captureFired is false
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is trans
In IDBRequest handler
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is request
In IDBTransaction error bubble
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is true
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is trans
In IDBDatabase error bubble
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is true
PASS bubbleFired is true
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is db
Transaction aborted
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is true
PASS bubbleFired is true
PASS dbBubbleFired is true
Verifing success.
trans = db.transaction(['storeName'], 'readwrite')
trans.oncomplete = transactionComplete
trans.onabort = unexpectedAbortCallback
trans.addEventListener('success', successCaptureCallback, true)
trans.addEventListener('success', successBubbleCallback, false)
trans.addEventListener('error', unexpectedErrorCallback, true)
trans.addEventListener('error', unexpectedErrorCallback, false)
db.removeEventListener('error', dbErrorCaptureCallback, true)
db.removeEventListener('error', dbErrorBubbleCallback, false)
db.removeEventListener('success', unexpectedSuccessCallback, true)
db.removeEventListener('success', unexpectedSuccessCallback, false)
db.addEventListener('success', dbSuccessCaptureCallback, true)
db.addEventListener('success', dbSuccessBubbleCallback, false)
db.addEventListener('error', unexpectedErrorCallback, true)
db.addEventListener('error', unexpectedErrorCallback, false)
store = trans.objectStore('storeName')
store.add({x: 'value', y: 'zzz'}, 'key2')
In IDBDatabase success capture
PASS dbCaptureFired is false
PASS captureFired is false
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is db
In IDBTransaction success capture
PASS dbCaptureFired is true
PASS captureFired is false
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is trans
In IDBRequest handler
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is false
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS event.target is request
PASS event.currentTarget is request
Transaction completed
PASS dbCaptureFired is true
PASS captureFired is true
PASS requestFired is true
PASS bubbleFired is false
PASS dbBubbleFired is false
PASS successfullyParsed is true
TEST COMPLETE