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