Home | History | Annotate | Download | only in indexeddb
      1 Test event propogation on IDBTransaction.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 webkitIndexedDB.open('transaction-event-propagation')
      7 db = event.target.result
      8 db.setVersion('new version')
      9 trans = event.target.result
     10 PASS trans !== null is true
     11 trans.oncomplete = startTest
     12 Deleted all object stores.
     13 store = db.createObjectStore('storeName', null)
     14 store.add({x: 'value', y: 'zzz'}, 'key')
     15 Verifing abort
     16 trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
     17 trans.onabort = abortFiredCallback
     18 trans.oncomplete = unexpectedAbortCallback
     19 db.addEventListener('abort', dbAbortCaptureCallback, true)
     20 db.addEventListener('abort', dbAbortBubbleCallback, false)
     21 db.addEventListener('complete', unexpectedCompleteCallback, true)
     22 db.addEventListener('complete', unexpectedCompleteCallback, false)
     23 store = trans.objectStore('storeName')
     24 store.add({x: 'value', y: 'zzz'}, 'key')
     25 
     26 In IDBDatabase abort capture
     27 PASS dbCaptureFired is false
     28 PASS abortFired is false
     29 PASS dbBubbleFired1 is false
     30 PASS event.target is trans
     31 PASS event.currentTarget is db
     32 
     33 In abort handler
     34 PASS dbCaptureFired is true
     35 PASS abortFired is false
     36 PASS dbBubbleFired1 is false
     37 PASS event.target is trans
     38 PASS event.currentTarget is trans
     39 
     40 In IDBDatabase error bubble
     41 PASS dbCaptureFired is true
     42 PASS abortFired is true
     43 PASS dbBubbleFired1 is false
     44 PASS event.target is trans
     45 PASS event.currentTarget is db
     46 
     47 Verifing success.
     48 trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
     49 trans.oncomplete = completeFiredCallback
     50 trans.onabort = unexpectedAbortCallback
     51 db.removeEventListener('abort', dbAbortCaptureCallback, true)
     52 db.removeEventListener('abort', dbAbortBubbleCallback, false)
     53 db.removeEventListener('complete', unexpectedCompleteCallback, true)
     54 db.removeEventListener('complete', unexpectedCompleteCallback, false)
     55 db.addEventListener('complete', dbCompleteCaptureCallback, true)
     56 db.addEventListener('complete', dbCompleteBubbleCallback, false)
     57 db.addEventListener('abort', unexpectedAbortCallback, true)
     58 db.addEventListener('abort', unexpectedAbortCallback, false)
     59 store = trans.objectStore('storeName')
     60 store.add({x: 'value', y: 'zzz'}, 'key2')
     61 
     62 In IDBDatabase complete capture
     63 PASS dbCaptureFired is false
     64 PASS completeFired is false
     65 PASS dbBubbleFired2 is false
     66 PASS event.target is trans
     67 PASS event.currentTarget is db
     68 
     69 In IDBRequest handler
     70 PASS dbCaptureFired is true
     71 PASS completeFired is false
     72 PASS dbBubbleFired2 is false
     73 PASS event.target is trans
     74 PASS event.currentTarget is trans
     75 
     76 PASS successfullyParsed is true
     77 
     78 TEST COMPLETE
     79 
     80