OLD | NEW |
1 Test IndexedDB transaction basics. | 1 Test IndexedDB transaction basics. |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; | 6 indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.
msIndexedDB || self.OIndexedDB; |
7 | 7 |
8 dbname = "transaction-basics.html" | 8 dbname = "transaction-basics.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
11 PASS self.db.objectStoreNames is [] | 11 PASS self.db.objectStoreNames is [] |
12 PASS self.db.objectStoreNames.length is 0 | 12 PASS self.db.objectStoreNames.length is 0 |
13 PASS self.db.objectStoreNames.contains('storeFail') is false | 13 PASS self.db.objectStoreNames.contains('storeFail') is false |
14 request = newConnection() | 14 request = newConnection() |
15 indexedDB.open(dbname, 2) | 15 indexedDB.open(dbname, 2) |
16 addRemoveIDBObjects(): | 16 addRemoveIDBObjects(): |
17 trans = event.target.transaction | 17 trans = event.target.transaction |
18 PASS trans is non-null. | 18 PASS trans is non-null. |
19 store = db.createObjectStore('storeFail', null) | 19 store = db.createObjectStore('storeFail', null) |
20 index = store.createIndex('indexFail', 'x') | 20 index = store.createIndex('indexFail', 'x') |
21 db.deleteObjectStore('storeFail') | 21 db.deleteObjectStore('storeFail') |
22 Expecting exception from store.deleteIndex('indexFail') | 22 Expecting exception from store.deleteIndex('indexFail') |
23 PASS Exception was thrown. | 23 PASS Exception was thrown. |
24 PASS code is DOMException.INVALID_STATE_ERR | 24 PASS code is DOMException.INVALID_STATE_ERR |
25 PASS ename is 'InvalidStateError' | 25 PASS ename is 'InvalidStateError' |
26 Exception message: The object store has been deleted. | 26 Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The obje
ct store has been deleted. |
27 | 27 |
28 testSetVersionAbort2(): | 28 testSetVersionAbort2(): |
29 PASS self.db.objectStoreNames is [] | 29 PASS self.db.objectStoreNames is [] |
30 PASS self.db.objectStoreNames.length is 0 | 30 PASS self.db.objectStoreNames.length is 0 |
31 PASS self.db.objectStoreNames.contains('storeFail') is false | 31 PASS self.db.objectStoreNames.contains('storeFail') is false |
32 request = newConnection() | 32 request = newConnection() |
33 indexedDB.open(dbname, 3) | 33 indexedDB.open(dbname, 3) |
34 addRemoveAddIDBObjects(): | 34 addRemoveAddIDBObjects(): |
35 trans = event.target.transaction | 35 trans = event.target.transaction |
36 PASS trans is non-null. | 36 PASS trans is non-null. |
37 store = db.createObjectStore('storeFail', null) | 37 store = db.createObjectStore('storeFail', null) |
38 index = store.createIndex('indexFail', 'x') | 38 index = store.createIndex('indexFail', 'x') |
39 db.deleteObjectStore('storeFail') | 39 db.deleteObjectStore('storeFail') |
40 Expecting exception from store.deleteIndex('indexFail') | 40 Expecting exception from store.deleteIndex('indexFail') |
41 PASS Exception was thrown. | 41 PASS Exception was thrown. |
42 PASS code is DOMException.INVALID_STATE_ERR | 42 PASS code is DOMException.INVALID_STATE_ERR |
43 PASS ename is 'InvalidStateError' | 43 PASS ename is 'InvalidStateError' |
44 Exception message: The object store has been deleted. | 44 Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The obje
ct store has been deleted. |
45 store = db.createObjectStore('storeFail', null) | 45 store = db.createObjectStore('storeFail', null) |
46 index = store.createIndex('indexFail', 'x') | 46 index = store.createIndex('indexFail', 'x') |
47 | 47 |
48 testSetVersionAbort3(): | 48 testSetVersionAbort3(): |
49 PASS event.cancelable is false | 49 PASS event.cancelable is false |
50 PASS self.db.objectStoreNames is [] | 50 PASS self.db.objectStoreNames is [] |
51 PASS self.db.objectStoreNames.length is 0 | 51 PASS self.db.objectStoreNames.length is 0 |
52 PASS self.db.objectStoreNames.contains('storeFail') is false | 52 PASS self.db.objectStoreNames.contains('storeFail') is false |
53 request = newConnection() | 53 request = newConnection() |
54 indexedDB.open(dbname, 4) | 54 indexedDB.open(dbname, 4) |
55 addIDBObjects(): | 55 addIDBObjects(): |
56 PASS event.cancelable is false | 56 PASS event.cancelable is false |
57 trans = event.target.transaction | 57 trans = event.target.transaction |
58 PASS trans is non-null. | 58 PASS trans is non-null. |
59 store = db.createObjectStore('storeFail', null) | 59 store = db.createObjectStore('storeFail', null) |
60 index = store.createIndex('indexFail', 'x') | 60 index = store.createIndex('indexFail', 'x') |
61 | 61 |
62 testInactiveAbortedTransaction(): | 62 testInactiveAbortedTransaction(): |
63 Expecting exception from index.openCursor() | 63 Expecting exception from index.openCursor() |
64 PASS Exception was thrown. | 64 PASS Exception was thrown. |
65 PASS code is 0 | 65 PASS code is 0 |
66 PASS ename is 'TransactionInactiveError' | 66 PASS ename is 'TransactionInactiveError' |
67 Exception message: The transaction has finished. | 67 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction
has finished. |
68 Expecting exception from index.openKeyCursor() | 68 Expecting exception from index.openKeyCursor() |
69 PASS Exception was thrown. | 69 PASS Exception was thrown. |
70 PASS code is 0 | 70 PASS code is 0 |
71 PASS ename is 'TransactionInactiveError' | 71 PASS ename is 'TransactionInactiveError' |
72 Exception message: The transaction has finished. | 72 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transact
ion has finished. |
73 Expecting exception from index.get(0) | 73 Expecting exception from index.get(0) |
74 PASS Exception was thrown. | 74 PASS Exception was thrown. |
75 PASS code is 0 | 75 PASS code is 0 |
76 PASS ename is 'TransactionInactiveError' | 76 PASS ename is 'TransactionInactiveError' |
77 Exception message: The transaction has finished. | 77 Exception message: Failed to execute 'get' on 'IDBIndex': The transaction has fi
nished. |
78 Expecting exception from index.getKey(0) | 78 Expecting exception from index.getKey(0) |
79 PASS Exception was thrown. | 79 PASS Exception was thrown. |
80 PASS code is 0 | 80 PASS code is 0 |
81 PASS ename is 'TransactionInactiveError' | 81 PASS ename is 'TransactionInactiveError' |
82 Exception message: The transaction has finished. | 82 Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction has
finished. |
83 Expecting exception from index.count() | 83 Expecting exception from index.count() |
84 PASS Exception was thrown. | 84 PASS Exception was thrown. |
85 PASS code is 0 | 85 PASS code is 0 |
86 PASS ename is 'TransactionInactiveError' | 86 PASS ename is 'TransactionInactiveError' |
87 Exception message: The transaction has finished. | 87 Exception message: Failed to execute 'count' on 'IDBIndex': The transaction has
finished. |
88 Expecting exception from store.put(0, 0) | 88 Expecting exception from store.put(0, 0) |
89 PASS Exception was thrown. | 89 PASS Exception was thrown. |
90 PASS code is 0 | 90 PASS code is 0 |
91 PASS ename is 'TransactionInactiveError' | 91 PASS ename is 'TransactionInactiveError' |
92 Exception message: The transaction has finished. | 92 Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction
has finished. |
93 Expecting exception from store.add(0, 0) | 93 Expecting exception from store.add(0, 0) |
94 PASS Exception was thrown. | 94 PASS Exception was thrown. |
95 PASS code is 0 | 95 PASS code is 0 |
96 PASS ename is 'TransactionInactiveError' | 96 PASS ename is 'TransactionInactiveError' |
97 Exception message: The transaction has finished. | 97 Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction
has finished. |
98 Expecting exception from store.delete(0) | 98 Expecting exception from store.delete(0) |
99 PASS Exception was thrown. | 99 PASS Exception was thrown. |
100 PASS code is 0 | 100 PASS code is 0 |
101 PASS ename is 'TransactionInactiveError' | 101 PASS ename is 'TransactionInactiveError' |
102 Exception message: The transaction has finished. | 102 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transacti
on has finished. |
103 Expecting exception from store.clear() | 103 Expecting exception from store.clear() |
104 PASS Exception was thrown. | 104 PASS Exception was thrown. |
105 PASS code is 0 | 105 PASS code is 0 |
106 PASS ename is 'TransactionInactiveError' | 106 PASS ename is 'TransactionInactiveError' |
107 Exception message: The transaction has finished. | 107 Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transactio
n has finished. |
108 Expecting exception from store.get(0) | 108 Expecting exception from store.get(0) |
109 PASS Exception was thrown. | 109 PASS Exception was thrown. |
110 PASS code is 0 | 110 PASS code is 0 |
111 PASS ename is 'TransactionInactiveError' | 111 PASS ename is 'TransactionInactiveError' |
112 Exception message: The transaction has finished. | 112 Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction
has finished. |
113 Expecting exception from store.openCursor() | 113 Expecting exception from store.openCursor() |
114 PASS Exception was thrown. | 114 PASS Exception was thrown. |
115 PASS code is 0 | 115 PASS code is 0 |
116 PASS ename is 'TransactionInactiveError' | 116 PASS ename is 'TransactionInactiveError' |
117 Exception message: The transaction has finished. | 117 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The trans
action has finished. |
118 | 118 |
119 testSetVersionAbort4(): | 119 testSetVersionAbort4(): |
120 PASS self.db.objectStoreNames is [] | 120 PASS self.db.objectStoreNames is [] |
121 PASS self.db.objectStoreNames.length is 0 | 121 PASS self.db.objectStoreNames.length is 0 |
122 PASS self.db.objectStoreNames.contains('storeFail') is false | 122 PASS self.db.objectStoreNames.contains('storeFail') is false |
123 request = newConnection() | 123 request = newConnection() |
124 indexedDB.open(dbname, 5) | 124 indexedDB.open(dbname, 5) |
125 addIDBObjectsAndCommit(): | 125 addIDBObjectsAndCommit(): |
126 trans = event.target.transaction | 126 trans = event.target.transaction |
127 PASS trans is non-null. | 127 PASS trans is non-null. |
128 store = db.createObjectStore('storeFail', null) | 128 store = db.createObjectStore('storeFail', null) |
129 index = store.createIndex('indexFail', 'x') | 129 index = store.createIndex('indexFail', 'x') |
130 | 130 |
131 testInactiveCompletedTransaction(): | 131 testInactiveCompletedTransaction(): |
132 Expecting exception from index.openCursor() | 132 Expecting exception from index.openCursor() |
133 PASS Exception was thrown. | 133 PASS Exception was thrown. |
134 PASS code is 0 | 134 PASS code is 0 |
135 PASS ename is 'TransactionInactiveError' | 135 PASS ename is 'TransactionInactiveError' |
136 Exception message: The transaction has finished. | 136 Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction
has finished. |
137 Expecting exception from index.openKeyCursor() | 137 Expecting exception from index.openKeyCursor() |
138 PASS Exception was thrown. | 138 PASS Exception was thrown. |
139 PASS code is 0 | 139 PASS code is 0 |
140 PASS ename is 'TransactionInactiveError' | 140 PASS ename is 'TransactionInactiveError' |
141 Exception message: The transaction has finished. | 141 Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transact
ion has finished. |
142 Expecting exception from index.get(0) | 142 Expecting exception from index.get(0) |
143 PASS Exception was thrown. | 143 PASS Exception was thrown. |
144 PASS code is 0 | 144 PASS code is 0 |
145 PASS ename is 'TransactionInactiveError' | 145 PASS ename is 'TransactionInactiveError' |
146 Exception message: The transaction has finished. | 146 Exception message: Failed to execute 'get' on 'IDBIndex': The transaction has fi
nished. |
147 Expecting exception from index.getKey(0) | 147 Expecting exception from index.getKey(0) |
148 PASS Exception was thrown. | 148 PASS Exception was thrown. |
149 PASS code is 0 | 149 PASS code is 0 |
150 PASS ename is 'TransactionInactiveError' | 150 PASS ename is 'TransactionInactiveError' |
151 Exception message: The transaction has finished. | 151 Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction has
finished. |
152 Expecting exception from index.count() | 152 Expecting exception from index.count() |
153 PASS Exception was thrown. | 153 PASS Exception was thrown. |
154 PASS code is 0 | 154 PASS code is 0 |
155 PASS ename is 'TransactionInactiveError' | 155 PASS ename is 'TransactionInactiveError' |
156 Exception message: The transaction has finished. | 156 Exception message: Failed to execute 'count' on 'IDBIndex': The transaction has
finished. |
157 Expecting exception from store.put(0, 0) | 157 Expecting exception from store.put(0, 0) |
158 PASS Exception was thrown. | 158 PASS Exception was thrown. |
159 PASS code is 0 | 159 PASS code is 0 |
160 PASS ename is 'TransactionInactiveError' | 160 PASS ename is 'TransactionInactiveError' |
161 Exception message: The transaction has finished. | 161 Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction
has finished. |
162 Expecting exception from store.add(0, 0) | 162 Expecting exception from store.add(0, 0) |
163 PASS Exception was thrown. | 163 PASS Exception was thrown. |
164 PASS code is 0 | 164 PASS code is 0 |
165 PASS ename is 'TransactionInactiveError' | 165 PASS ename is 'TransactionInactiveError' |
166 Exception message: The transaction has finished. | 166 Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction
has finished. |
167 Expecting exception from store.delete(0) | 167 Expecting exception from store.delete(0) |
168 PASS Exception was thrown. | 168 PASS Exception was thrown. |
169 PASS code is 0 | 169 PASS code is 0 |
170 PASS ename is 'TransactionInactiveError' | 170 PASS ename is 'TransactionInactiveError' |
171 Exception message: The transaction has finished. | 171 Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transacti
on has finished. |
172 Expecting exception from store.clear() | 172 Expecting exception from store.clear() |
173 PASS Exception was thrown. | 173 PASS Exception was thrown. |
174 PASS code is 0 | 174 PASS code is 0 |
175 PASS ename is 'TransactionInactiveError' | 175 PASS ename is 'TransactionInactiveError' |
176 Exception message: The transaction has finished. | 176 Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transactio
n has finished. |
177 Expecting exception from store.get(0) | 177 Expecting exception from store.get(0) |
178 PASS Exception was thrown. | 178 PASS Exception was thrown. |
179 PASS code is 0 | 179 PASS code is 0 |
180 PASS ename is 'TransactionInactiveError' | 180 PASS ename is 'TransactionInactiveError' |
181 Exception message: The transaction has finished. | 181 Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction
has finished. |
182 Expecting exception from store.openCursor() | 182 Expecting exception from store.openCursor() |
183 PASS Exception was thrown. | 183 PASS Exception was thrown. |
184 PASS code is 0 | 184 PASS code is 0 |
185 PASS ename is 'TransactionInactiveError' | 185 PASS ename is 'TransactionInactiveError' |
186 Exception message: The transaction has finished. | 186 Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The trans
action has finished. |
187 | 187 |
188 testSetVersionAbort5(): | 188 testSetVersionAbort5(): |
189 PASS db.objectStoreNames is ['storeFail'] | 189 PASS db.objectStoreNames is ['storeFail'] |
190 PASS db.objectStoreNames.length is 1 | 190 PASS db.objectStoreNames.length is 1 |
191 PASS db.objectStoreNames.contains('storeFail') is true | 191 PASS db.objectStoreNames.contains('storeFail') is true |
192 request = newConnection() | 192 request = newConnection() |
193 indexedDB.open(dbname, 6) | 193 indexedDB.open(dbname, 6) |
194 removeIDBObjects(): | 194 removeIDBObjects(): |
195 trans = event.target.transaction | 195 trans = event.target.transaction |
196 PASS trans is non-null. | 196 PASS trans is non-null. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 Verify that specifying an invalid mode raises an exception | 230 Verify that specifying an invalid mode raises an exception |
231 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') | 231 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') |
232 PASS Exception was thrown. | 232 PASS Exception was thrown. |
233 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Type error | 233 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Type error |
234 | 234 |
235 Test that null and undefined are treated as strings | 235 Test that null and undefined are treated as strings |
236 Expecting exception from db.transaction(null) | 236 Expecting exception from db.transaction(null) |
237 PASS Exception was thrown. | 237 PASS Exception was thrown. |
238 PASS code is DOMException.NOT_FOUND_ERR | 238 PASS code is DOMException.NOT_FOUND_ERR |
239 PASS ename is 'NotFoundError' | 239 PASS ename is 'NotFoundError' |
240 Exception message: One of the specified object stores was not found. | 240 Exception message: Failed to execute 'transaction' on 'IDBDatabase': One of the
specified object stores was not found. |
241 Expecting exception from db.transaction(undefined) | 241 Expecting exception from db.transaction(undefined) |
242 PASS Exception was thrown. | 242 PASS Exception was thrown. |
243 PASS code is DOMException.NOT_FOUND_ERR | 243 PASS code is DOMException.NOT_FOUND_ERR |
244 PASS ename is 'NotFoundError' | 244 PASS ename is 'NotFoundError' |
245 Exception message: One of the specified object stores was not found. | 245 Exception message: Failed to execute 'transaction' on 'IDBDatabase': One of the
specified object stores was not found. |
246 request = newConnection() | 246 request = newConnection() |
247 indexedDB.open(dbname, 8) | 247 indexedDB.open(dbname, 8) |
248 db.createObjectStore('null') | 248 db.createObjectStore('null') |
249 db.createObjectStore('undefined') | 249 db.createObjectStore('undefined') |
250 PASS transaction = db.transaction(null) did not throw exception. | 250 PASS transaction = db.transaction(null) did not throw exception. |
251 PASS transaction.objectStore('null') is non-null. | 251 PASS transaction.objectStore('null') is non-null. |
252 PASS transaction = db.transaction(undefined) did not throw exception. | 252 PASS transaction = db.transaction(undefined) did not throw exception. |
253 PASS transaction.objectStore('undefined') is non-null. | 253 PASS transaction.objectStore('undefined') is non-null. |
254 PASS successfullyParsed is true | 254 PASS successfullyParsed is true |
255 | 255 |
256 TEST COMPLETE | 256 TEST COMPLETE |
257 | 257 |
OLD | NEW |