1 Test IndexedDB transaction internal active flag.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "transaction-active-flag.html"
7 indexedDB.deleteDatabase(dbname)
9 store = db.createObjectStore('store')
10 store.createIndex('index', 'keypath')
13 transaction = db.transaction('store', 'readwrite')
15 Verify that transactions are created with |active| flag set:
16 store = transaction.objectStore('store')
17 index = store.index('index')
18 PASS store.add(0, 0) did not throw exception.
19 PASS store.put(0, 0) did not throw exception.
20 PASS store.get(0) did not throw exception.
21 PASS store.get(IDBKeyRange.only(0)) did not throw exception.
22 PASS store.delete(0) did not throw exception.
23 PASS store.delete(IDBKeyRange.only(0)) did not throw exception.
24 PASS store.count() did not throw exception.
25 PASS store.count(0) did not throw exception.
26 PASS store.count(IDBKeyRange.only(0)) did not throw exception.
27 PASS store.clear() did not throw exception.
28 PASS store.openCursor() did not throw exception.
29 PASS store.openCursor(0) did not throw exception.
30 PASS store.openCursor(0, 'next') did not throw exception.
31 PASS store.openCursor(IDBKeyRange.only(0)) did not throw exception.
32 PASS store.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
33 PASS index.get(0) did not throw exception.
34 PASS index.get(IDBKeyRange.only(0)) did not throw exception.
35 PASS index.getKey(0) did not throw exception.
36 PASS index.getKey(IDBKeyRange.only(0)) did not throw exception.
37 PASS index.count() did not throw exception.
38 PASS index.count(0) did not throw exception.
39 PASS index.count(IDBKeyRange.only(0)) did not throw exception.
40 PASS index.openCursor() did not throw exception.
41 PASS index.openCursor(0) did not throw exception.
42 PASS index.openCursor(0, 'next') did not throw exception.
43 PASS index.openCursor(IDBKeyRange.only(0)) did not throw exception.
44 PASS index.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
45 PASS index.openKeyCursor() did not throw exception.
46 PASS index.openKeyCursor(0) did not throw exception.
47 PASS index.openKeyCursor(0, 'next') did not throw exception.
48 PASS index.openKeyCursor(IDBKeyRange.only(0)) did not throw exception.
49 PASS index.openKeyCursor(IDBKeyRange.only(0), 'next') did not throw exception.
51 Transaction shouldn't be active inside a non-IDB-event callback
52 setTimeout(testTimeout, 0)
55 store = transaction.objectStore('store')
56 index = store.index('index')
57 Expecting exception from store.add(0, 0)
58 PASS Exception was thrown.
60 PASS ename is 'TransactionInactiveError'
61 Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction is not active.
62 Expecting exception from store.put(0, 0)
63 PASS Exception was thrown.
65 PASS ename is 'TransactionInactiveError'
66 Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction is not active.
67 Expecting exception from store.get(0)
68 PASS Exception was thrown.
70 PASS ename is 'TransactionInactiveError'
71 Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is not active.
72 Expecting exception from store.get(IDBKeyRange.only(0))
73 PASS Exception was thrown.
75 PASS ename is 'TransactionInactiveError'
76 Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction is not active.
77 Expecting exception from store.delete(0)
78 PASS Exception was thrown.
80 PASS ename is 'TransactionInactiveError'
81 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction is not active.
82 Expecting exception from store.delete(IDBKeyRange.only(0))
83 PASS Exception was thrown.
85 PASS ename is 'TransactionInactiveError'
86 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction is not active.
87 Expecting exception from store.count()
88 PASS Exception was thrown.
90 PASS ename is 'TransactionInactiveError'
91 Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is not active.
92 Expecting exception from store.count(0)
93 PASS Exception was thrown.
95 PASS ename is 'TransactionInactiveError'
96 Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is not active.
97 Expecting exception from store.count(IDBKeyRange.only(0))
98 PASS Exception was thrown.
100 PASS ename is 'TransactionInactiveError'
101 Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is not active.
102 Expecting exception from store.clear()
103 PASS Exception was thrown.
105 PASS ename is 'TransactionInactiveError'
106 Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transaction is not active.
107 Expecting exception from store.openCursor()
108 PASS Exception was thrown.
110 PASS ename is 'TransactionInactiveError'
111 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is not active.
112 Expecting exception from store.openCursor(0)
113 PASS Exception was thrown.
115 PASS ename is 'TransactionInactiveError'
116 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is not active.
117 Expecting exception from store.openCursor(0, 'next')
118 PASS Exception was thrown.
120 PASS ename is 'TransactionInactiveError'
121 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is not active.
122 Expecting exception from store.openCursor(IDBKeyRange.only(0))
123 PASS Exception was thrown.
125 PASS ename is 'TransactionInactiveError'
126 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is not active.
127 Expecting exception from store.openCursor(IDBKeyRange.only(0), 'next')
128 PASS Exception was thrown.
130 PASS ename is 'TransactionInactiveError'
131 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is not active.
132 Expecting exception from index.get(0)
133 PASS Exception was thrown.
135 PASS ename is 'TransactionInactiveError'
136 Exception message: Failed to execute 'get' on 'IDBIndex': The transaction is not active.
137 Expecting exception from index.get(IDBKeyRange.only(0))
138 PASS Exception was thrown.
140 PASS ename is 'TransactionInactiveError'
141 Exception message: Failed to execute 'get' on 'IDBIndex': The transaction is not active.
142 Expecting exception from index.getKey(0)
143 PASS Exception was thrown.
145 PASS ename is 'TransactionInactiveError'
146 Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction is not active.
147 Expecting exception from index.getKey(IDBKeyRange.only(0))
148 PASS Exception was thrown.
150 PASS ename is 'TransactionInactiveError'
151 Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction is not active.
152 Expecting exception from index.count()
153 PASS Exception was thrown.
155 PASS ename is 'TransactionInactiveError'
156 Exception message: Failed to execute 'count' on 'IDBIndex': The transaction is not active.
157 Expecting exception from index.count(0)
158 PASS Exception was thrown.
160 PASS ename is 'TransactionInactiveError'
161 Exception message: Failed to execute 'count' on 'IDBIndex': The transaction is not active.
162 Expecting exception from index.count(IDBKeyRange.only(0))
163 PASS Exception was thrown.
165 PASS ename is 'TransactionInactiveError'
166 Exception message: Failed to execute 'count' on 'IDBIndex': The transaction is not active.
167 Expecting exception from index.openCursor()
168 PASS Exception was thrown.
170 PASS ename is 'TransactionInactiveError'
171 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is not active.
172 Expecting exception from index.openCursor(0)
173 PASS Exception was thrown.
175 PASS ename is 'TransactionInactiveError'
176 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is not active.
177 Expecting exception from index.openCursor(0, 'next')
178 PASS Exception was thrown.
180 PASS ename is 'TransactionInactiveError'
181 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is not active.
182 Expecting exception from index.openCursor(IDBKeyRange.only(0))
183 PASS Exception was thrown.
185 PASS ename is 'TransactionInactiveError'
186 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is not active.
187 Expecting exception from index.openCursor(IDBKeyRange.only(0), 'next')
188 PASS Exception was thrown.
190 PASS ename is 'TransactionInactiveError'
191 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is not active.
192 Expecting exception from index.openKeyCursor()
193 PASS Exception was thrown.
195 PASS ename is 'TransactionInactiveError'
196 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is not active.
197 Expecting exception from index.openKeyCursor(0)
198 PASS Exception was thrown.
200 PASS ename is 'TransactionInactiveError'
201 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is not active.
202 Expecting exception from index.openKeyCursor(0, 'next')
203 PASS Exception was thrown.
205 PASS ename is 'TransactionInactiveError'
206 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is not active.
207 Expecting exception from index.openKeyCursor(IDBKeyRange.only(0))
208 PASS Exception was thrown.
210 PASS ename is 'TransactionInactiveError'
211 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is not active.
212 Expecting exception from index.openKeyCursor(IDBKeyRange.only(0), 'next')
213 PASS Exception was thrown.
215 PASS ename is 'TransactionInactiveError'
216 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is not active.
219 Transaction should be active inside a non-IDB-event callback
220 store = transaction.objectStore('store')
221 index = store.index('index')
222 PASS store.add(0, 0) did not throw exception.
223 PASS store.put(0, 0) did not throw exception.
224 PASS store.get(0) did not throw exception.
225 PASS store.get(IDBKeyRange.only(0)) did not throw exception.
226 PASS store.delete(0) did not throw exception.
227 PASS store.delete(IDBKeyRange.only(0)) did not throw exception.
228 PASS store.count() did not throw exception.
229 PASS store.count(0) did not throw exception.
230 PASS store.count(IDBKeyRange.only(0)) did not throw exception.
231 PASS store.clear() did not throw exception.
232 PASS store.openCursor() did not throw exception.
233 PASS store.openCursor(0) did not throw exception.
234 PASS store.openCursor(0, 'next') did not throw exception.
235 PASS store.openCursor(IDBKeyRange.only(0)) did not throw exception.
236 PASS store.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
237 PASS index.get(0) did not throw exception.
238 PASS index.get(IDBKeyRange.only(0)) did not throw exception.
239 PASS index.getKey(0) did not throw exception.
240 PASS index.getKey(IDBKeyRange.only(0)) did not throw exception.
241 PASS index.count() did not throw exception.
242 PASS index.count(0) did not throw exception.
243 PASS index.count(IDBKeyRange.only(0)) did not throw exception.
244 PASS index.openCursor() did not throw exception.
245 PASS index.openCursor(0) did not throw exception.
246 PASS index.openCursor(0, 'next') did not throw exception.
247 PASS index.openCursor(IDBKeyRange.only(0)) did not throw exception.
248 PASS index.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
249 PASS index.openKeyCursor() did not throw exception.
250 PASS index.openKeyCursor(0) did not throw exception.
251 PASS index.openKeyCursor(0, 'next') did not throw exception.
252 PASS index.openKeyCursor(IDBKeyRange.only(0)) did not throw exception.
253 PASS index.openKeyCursor(IDBKeyRange.only(0), 'next') did not throw exception.
255 transactionComplete():
256 Expecting exception from store = transaction.objectStore('store')
257 PASS Exception was thrown.
258 PASS code is DOMException.INVALID_STATE_ERR
259 PASS ename is 'InvalidStateError'
260 Exception message: Failed to execute 'objectStore' on 'IDBTransaction': The transaction has finished.
261 PASS successfullyParsed is true