Home | History | Annotate | Download | only in indexeddb
      1 Test event propogation on IDBRequest.
      2 
      3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
      4 
      5 
      6 webkitIndexedDB.open('request-event-propagation')
      7 db = event.target.result
      8 db.setVersion('new version')
      9 setVersionSuccess():
     10 trans = event.target.result
     11 PASS trans !== null is true
     12 trans.oncomplete = startTest
     13 Deleted all object stores.
     14 store = db.createObjectStore('storeName', null)
     15 store.add({x: 'value', y: 'zzz'}, 'key')
     16 Verify that handler fires and that not preventing default will result in an abort
     17 trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
     18 trans.onabort = transactionAborted
     19 trans.oncomplete = unexpectedCompleteCallback
     20 trans.onerror = allowDefault
     21 store = trans.objectStore('storeName')
     22 store.add({x: 'value', y: 'zzz'}, 'key')
     23 PASS Event handler fired
     24 Doing nothing to prevent the default action...
     25 PASS handlerFired is true
     26 
     27 Verifing error
     28 trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
     29 trans.onabort = transactionAborted2
     30 trans.oncomplete = unexpectedAbortCallback
     31 trans.addEventListener('error', errorCaptureCallback, true)
     32 trans.addEventListener('error', errorBubbleCallback, false)
     33 trans.addEventListener('success', unexpectedSuccessCallback, true)
     34 trans.addEventListener('success', unexpectedSuccessCallback, false)
     35 db.addEventListener('error', dbErrorCaptureCallback, true)
     36 db.addEventListener('error', dbErrorBubbleCallback, false)
     37 db.addEventListener('success', unexpectedSuccessCallback, true)
     38 db.addEventListener('success', unexpectedSuccessCallback, false)
     39 store = trans.objectStore('storeName')
     40 store.add({x: 'value', y: 'zzz'}, 'key')
     41 
     42 In IDBDatabase error capture
     43 PASS dbCaptureFired is false
     44 PASS captureFired is false
     45 PASS requestFired is false
     46 PASS bubbleFired is false
     47 PASS dbBubbleFired is false
     48 PASS event.target is request
     49 PASS event.currentTarget is db
     50 
     51 In IDBTransaction error capture
     52 PASS dbCaptureFired is true
     53 PASS captureFired is false
     54 PASS requestFired is false
     55 PASS bubbleFired is false
     56 PASS dbBubbleFired is false
     57 PASS event.target is request
     58 PASS event.currentTarget is trans
     59 
     60 In IDBRequest handler
     61 PASS dbCaptureFired is true
     62 PASS captureFired is true
     63 PASS requestFired is false
     64 PASS bubbleFired is false
     65 PASS dbBubbleFired is false
     66 PASS event.target is request
     67 PASS event.currentTarget is request
     68 
     69 In IDBTransaction error bubble
     70 PASS dbCaptureFired is true
     71 PASS captureFired is true
     72 PASS requestFired is true
     73 PASS bubbleFired is false
     74 PASS dbBubbleFired is false
     75 PASS event.target is request
     76 PASS event.currentTarget is trans
     77 
     78 In IDBDatabase error bubble
     79 PASS dbCaptureFired is true
     80 PASS captureFired is true
     81 PASS requestFired is true
     82 PASS bubbleFired is true
     83 PASS dbBubbleFired is false
     84 PASS event.target is request
     85 PASS event.currentTarget is db
     86 
     87 Transaction aborted
     88 PASS dbCaptureFired is true
     89 PASS captureFired is true
     90 PASS requestFired is true
     91 PASS bubbleFired is true
     92 PASS dbBubbleFired is true
     93 
     94 Verifing success.
     95 trans = db.transaction([], webkitIDBTransaction.READ_WRITE)
     96 trans.oncomplete = transactionComplete
     97 trans.onabort = unexpectedAbortCallback
     98 trans.addEventListener('success', successCaptureCallback, true)
     99 trans.addEventListener('success', successBubbleCallback, false)
    100 trans.addEventListener('error', unexpectedErrorCallback, true)
    101 trans.addEventListener('error', unexpectedErrorCallback, false)
    102 db.removeEventListener('error', dbErrorCaptureCallback, true)
    103 db.removeEventListener('error', dbErrorBubbleCallback, false)
    104 db.removeEventListener('success', unexpectedSuccessCallback, true)
    105 db.removeEventListener('success', unexpectedSuccessCallback, false)
    106 db.addEventListener('success', dbSuccessCaptureCallback, true)
    107 db.addEventListener('success', dbSuccessBubbleCallback, false)
    108 db.addEventListener('error', unexpectedErrorCallback, true)
    109 db.addEventListener('error', unexpectedErrorCallback, false)
    110 store = trans.objectStore('storeName')
    111 store.add({x: 'value', y: 'zzz'}, 'key2')
    112 
    113 In IDBDatabase success capture
    114 PASS dbCaptureFired is false
    115 PASS captureFired is false
    116 PASS requestFired is false
    117 PASS bubbleFired is false
    118 PASS dbBubbleFired is false
    119 PASS event.target is request
    120 PASS event.currentTarget is db
    121 
    122 In IDBTransaction success capture
    123 PASS dbCaptureFired is true
    124 PASS captureFired is false
    125 PASS requestFired is false
    126 PASS bubbleFired is false
    127 PASS dbBubbleFired is false
    128 PASS event.target is request
    129 PASS event.currentTarget is trans
    130 
    131 In IDBRequest handler
    132 PASS dbCaptureFired is true
    133 PASS captureFired is true
    134 PASS requestFired is false
    135 PASS bubbleFired is false
    136 PASS dbBubbleFired is false
    137 PASS event.target is request
    138 PASS event.currentTarget is request
    139 
    140 Transaction completed
    141 PASS dbCaptureFired is true
    142 PASS captureFired is true
    143 PASS requestFired is true
    144 PASS bubbleFired is false
    145 PASS dbBubbleFired is false
    146 
    147 PASS successfullyParsed is true
    148 
    149 TEST COMPLETE
    150 
    151