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 | 27 |
27 testSetVersionAbort2(): | 28 testSetVersionAbort2(): |
28 PASS self.db.objectStoreNames is [] | 29 PASS self.db.objectStoreNames is [] |
29 PASS self.db.objectStoreNames.length is 0 | 30 PASS self.db.objectStoreNames.length is 0 |
30 PASS self.db.objectStoreNames.contains('storeFail') is false | 31 PASS self.db.objectStoreNames.contains('storeFail') is false |
31 request = newConnection() | 32 request = newConnection() |
32 indexedDB.open(dbname, 3) | 33 indexedDB.open(dbname, 3) |
33 addRemoveAddIDBObjects(): | 34 addRemoveAddIDBObjects(): |
34 trans = event.target.transaction | 35 trans = event.target.transaction |
35 PASS trans is non-null. | 36 PASS trans is non-null. |
36 store = db.createObjectStore('storeFail', null) | 37 store = db.createObjectStore('storeFail', null) |
37 index = store.createIndex('indexFail', 'x') | 38 index = store.createIndex('indexFail', 'x') |
38 db.deleteObjectStore('storeFail') | 39 db.deleteObjectStore('storeFail') |
39 Expecting exception from store.deleteIndex('indexFail') | 40 Expecting exception from store.deleteIndex('indexFail') |
40 PASS Exception was thrown. | 41 PASS Exception was thrown. |
41 PASS code is DOMException.INVALID_STATE_ERR | 42 PASS code is DOMException.INVALID_STATE_ERR |
42 PASS ename is 'InvalidStateError' | 43 PASS ename is 'InvalidStateError' |
| 44 Exception message: The object store has been deleted. |
43 store = db.createObjectStore('storeFail', null) | 45 store = db.createObjectStore('storeFail', null) |
44 index = store.createIndex('indexFail', 'x') | 46 index = store.createIndex('indexFail', 'x') |
45 | 47 |
46 testSetVersionAbort3(): | 48 testSetVersionAbort3(): |
47 PASS event.cancelable is false | 49 PASS event.cancelable is false |
48 PASS self.db.objectStoreNames is [] | 50 PASS self.db.objectStoreNames is [] |
49 PASS self.db.objectStoreNames.length is 0 | 51 PASS self.db.objectStoreNames.length is 0 |
50 PASS self.db.objectStoreNames.contains('storeFail') is false | 52 PASS self.db.objectStoreNames.contains('storeFail') is false |
51 request = newConnection() | 53 request = newConnection() |
52 indexedDB.open(dbname, 4) | 54 indexedDB.open(dbname, 4) |
53 addIDBObjects(): | 55 addIDBObjects(): |
54 PASS event.cancelable is false | 56 PASS event.cancelable is false |
55 trans = event.target.transaction | 57 trans = event.target.transaction |
56 PASS trans is non-null. | 58 PASS trans is non-null. |
57 store = db.createObjectStore('storeFail', null) | 59 store = db.createObjectStore('storeFail', null) |
58 index = store.createIndex('indexFail', 'x') | 60 index = store.createIndex('indexFail', 'x') |
59 | 61 |
60 testInactiveAbortedTransaction(): | 62 testInactiveAbortedTransaction(): |
61 Expecting exception from index.openCursor() | 63 Expecting exception from index.openCursor() |
62 PASS Exception was thrown. | 64 PASS Exception was thrown. |
63 PASS code is 0 | 65 PASS code is 0 |
64 PASS ename is 'TransactionInactiveError' | 66 PASS ename is 'TransactionInactiveError' |
| 67 Exception message: The transaction has finished. |
65 Expecting exception from index.openKeyCursor() | 68 Expecting exception from index.openKeyCursor() |
66 PASS Exception was thrown. | 69 PASS Exception was thrown. |
67 PASS code is 0 | 70 PASS code is 0 |
68 PASS ename is 'TransactionInactiveError' | 71 PASS ename is 'TransactionInactiveError' |
| 72 Exception message: The transaction has finished. |
69 Expecting exception from index.get(0) | 73 Expecting exception from index.get(0) |
70 PASS Exception was thrown. | 74 PASS Exception was thrown. |
71 PASS code is 0 | 75 PASS code is 0 |
72 PASS ename is 'TransactionInactiveError' | 76 PASS ename is 'TransactionInactiveError' |
| 77 Exception message: The transaction has finished. |
73 Expecting exception from index.getKey(0) | 78 Expecting exception from index.getKey(0) |
74 PASS Exception was thrown. | 79 PASS Exception was thrown. |
75 PASS code is 0 | 80 PASS code is 0 |
76 PASS ename is 'TransactionInactiveError' | 81 PASS ename is 'TransactionInactiveError' |
| 82 Exception message: The transaction has finished. |
77 Expecting exception from index.count() | 83 Expecting exception from index.count() |
78 PASS Exception was thrown. | 84 PASS Exception was thrown. |
79 PASS code is 0 | 85 PASS code is 0 |
80 PASS ename is 'TransactionInactiveError' | 86 PASS ename is 'TransactionInactiveError' |
| 87 Exception message: The transaction has finished. |
81 Expecting exception from store.put(0, 0) | 88 Expecting exception from store.put(0, 0) |
82 PASS Exception was thrown. | 89 PASS Exception was thrown. |
83 PASS code is 0 | 90 PASS code is 0 |
84 PASS ename is 'TransactionInactiveError' | 91 PASS ename is 'TransactionInactiveError' |
| 92 Exception message: The transaction has finished. |
85 Expecting exception from store.add(0, 0) | 93 Expecting exception from store.add(0, 0) |
86 PASS Exception was thrown. | 94 PASS Exception was thrown. |
87 PASS code is 0 | 95 PASS code is 0 |
88 PASS ename is 'TransactionInactiveError' | 96 PASS ename is 'TransactionInactiveError' |
| 97 Exception message: The transaction has finished. |
89 Expecting exception from store.delete(0) | 98 Expecting exception from store.delete(0) |
90 PASS Exception was thrown. | 99 PASS Exception was thrown. |
91 PASS code is 0 | 100 PASS code is 0 |
92 PASS ename is 'TransactionInactiveError' | 101 PASS ename is 'TransactionInactiveError' |
| 102 Exception message: The transaction has finished. |
93 Expecting exception from store.clear() | 103 Expecting exception from store.clear() |
94 PASS Exception was thrown. | 104 PASS Exception was thrown. |
95 PASS code is 0 | 105 PASS code is 0 |
96 PASS ename is 'TransactionInactiveError' | 106 PASS ename is 'TransactionInactiveError' |
| 107 Exception message: The transaction has finished. |
97 Expecting exception from store.get(0) | 108 Expecting exception from store.get(0) |
98 PASS Exception was thrown. | 109 PASS Exception was thrown. |
99 PASS code is 0 | 110 PASS code is 0 |
100 PASS ename is 'TransactionInactiveError' | 111 PASS ename is 'TransactionInactiveError' |
| 112 Exception message: The transaction has finished. |
101 Expecting exception from store.openCursor() | 113 Expecting exception from store.openCursor() |
102 PASS Exception was thrown. | 114 PASS Exception was thrown. |
103 PASS code is 0 | 115 PASS code is 0 |
104 PASS ename is 'TransactionInactiveError' | 116 PASS ename is 'TransactionInactiveError' |
| 117 Exception message: The transaction has finished. |
105 | 118 |
106 testSetVersionAbort4(): | 119 testSetVersionAbort4(): |
107 PASS self.db.objectStoreNames is [] | 120 PASS self.db.objectStoreNames is [] |
108 PASS self.db.objectStoreNames.length is 0 | 121 PASS self.db.objectStoreNames.length is 0 |
109 PASS self.db.objectStoreNames.contains('storeFail') is false | 122 PASS self.db.objectStoreNames.contains('storeFail') is false |
110 request = newConnection() | 123 request = newConnection() |
111 indexedDB.open(dbname, 5) | 124 indexedDB.open(dbname, 5) |
112 addIDBObjectsAndCommit(): | 125 addIDBObjectsAndCommit(): |
113 trans = event.target.transaction | 126 trans = event.target.transaction |
114 PASS trans is non-null. | 127 PASS trans is non-null. |
115 store = db.createObjectStore('storeFail', null) | 128 store = db.createObjectStore('storeFail', null) |
116 index = store.createIndex('indexFail', 'x') | 129 index = store.createIndex('indexFail', 'x') |
117 | 130 |
118 testInactiveCompletedTransaction(): | 131 testInactiveCompletedTransaction(): |
119 Expecting exception from index.openCursor() | 132 Expecting exception from index.openCursor() |
120 PASS Exception was thrown. | 133 PASS Exception was thrown. |
121 PASS code is 0 | 134 PASS code is 0 |
122 PASS ename is 'TransactionInactiveError' | 135 PASS ename is 'TransactionInactiveError' |
| 136 Exception message: The transaction has finished. |
123 Expecting exception from index.openKeyCursor() | 137 Expecting exception from index.openKeyCursor() |
124 PASS Exception was thrown. | 138 PASS Exception was thrown. |
125 PASS code is 0 | 139 PASS code is 0 |
126 PASS ename is 'TransactionInactiveError' | 140 PASS ename is 'TransactionInactiveError' |
| 141 Exception message: The transaction has finished. |
127 Expecting exception from index.get(0) | 142 Expecting exception from index.get(0) |
128 PASS Exception was thrown. | 143 PASS Exception was thrown. |
129 PASS code is 0 | 144 PASS code is 0 |
130 PASS ename is 'TransactionInactiveError' | 145 PASS ename is 'TransactionInactiveError' |
| 146 Exception message: The transaction has finished. |
131 Expecting exception from index.getKey(0) | 147 Expecting exception from index.getKey(0) |
132 PASS Exception was thrown. | 148 PASS Exception was thrown. |
133 PASS code is 0 | 149 PASS code is 0 |
134 PASS ename is 'TransactionInactiveError' | 150 PASS ename is 'TransactionInactiveError' |
| 151 Exception message: The transaction has finished. |
135 Expecting exception from index.count() | 152 Expecting exception from index.count() |
136 PASS Exception was thrown. | 153 PASS Exception was thrown. |
137 PASS code is 0 | 154 PASS code is 0 |
138 PASS ename is 'TransactionInactiveError' | 155 PASS ename is 'TransactionInactiveError' |
| 156 Exception message: The transaction has finished. |
139 Expecting exception from store.put(0, 0) | 157 Expecting exception from store.put(0, 0) |
140 PASS Exception was thrown. | 158 PASS Exception was thrown. |
141 PASS code is 0 | 159 PASS code is 0 |
142 PASS ename is 'TransactionInactiveError' | 160 PASS ename is 'TransactionInactiveError' |
| 161 Exception message: The transaction has finished. |
143 Expecting exception from store.add(0, 0) | 162 Expecting exception from store.add(0, 0) |
144 PASS Exception was thrown. | 163 PASS Exception was thrown. |
145 PASS code is 0 | 164 PASS code is 0 |
146 PASS ename is 'TransactionInactiveError' | 165 PASS ename is 'TransactionInactiveError' |
| 166 Exception message: The transaction has finished. |
147 Expecting exception from store.delete(0) | 167 Expecting exception from store.delete(0) |
148 PASS Exception was thrown. | 168 PASS Exception was thrown. |
149 PASS code is 0 | 169 PASS code is 0 |
150 PASS ename is 'TransactionInactiveError' | 170 PASS ename is 'TransactionInactiveError' |
| 171 Exception message: The transaction has finished. |
151 Expecting exception from store.clear() | 172 Expecting exception from store.clear() |
152 PASS Exception was thrown. | 173 PASS Exception was thrown. |
153 PASS code is 0 | 174 PASS code is 0 |
154 PASS ename is 'TransactionInactiveError' | 175 PASS ename is 'TransactionInactiveError' |
| 176 Exception message: The transaction has finished. |
155 Expecting exception from store.get(0) | 177 Expecting exception from store.get(0) |
156 PASS Exception was thrown. | 178 PASS Exception was thrown. |
157 PASS code is 0 | 179 PASS code is 0 |
158 PASS ename is 'TransactionInactiveError' | 180 PASS ename is 'TransactionInactiveError' |
| 181 Exception message: The transaction has finished. |
159 Expecting exception from store.openCursor() | 182 Expecting exception from store.openCursor() |
160 PASS Exception was thrown. | 183 PASS Exception was thrown. |
161 PASS code is 0 | 184 PASS code is 0 |
162 PASS ename is 'TransactionInactiveError' | 185 PASS ename is 'TransactionInactiveError' |
| 186 Exception message: The transaction has finished. |
163 | 187 |
164 testSetVersionAbort5(): | 188 testSetVersionAbort5(): |
165 PASS db.objectStoreNames is ['storeFail'] | 189 PASS db.objectStoreNames is ['storeFail'] |
166 PASS db.objectStoreNames.length is 1 | 190 PASS db.objectStoreNames.length is 1 |
167 PASS db.objectStoreNames.contains('storeFail') is true | 191 PASS db.objectStoreNames.contains('storeFail') is true |
168 request = newConnection() | 192 request = newConnection() |
169 indexedDB.open(dbname, 6) | 193 indexedDB.open(dbname, 6) |
170 removeIDBObjects(): | 194 removeIDBObjects(): |
171 trans = event.target.transaction | 195 trans = event.target.transaction |
172 PASS trans is non-null. | 196 PASS trans is non-null. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 Verify that specifying an invalid mode raises an exception | 230 Verify that specifying an invalid mode raises an exception |
207 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') | 231 Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf') |
208 PASS Exception was thrown. | 232 PASS Exception was thrown. |
209 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Type error | 233 PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Type error |
210 | 234 |
211 Test that null and undefined are treated as strings | 235 Test that null and undefined are treated as strings |
212 Expecting exception from db.transaction(null) | 236 Expecting exception from db.transaction(null) |
213 PASS Exception was thrown. | 237 PASS Exception was thrown. |
214 PASS code is DOMException.NOT_FOUND_ERR | 238 PASS code is DOMException.NOT_FOUND_ERR |
215 PASS ename is 'NotFoundError' | 239 PASS ename is 'NotFoundError' |
| 240 Exception message: One of the specified object stores was not found. |
216 Expecting exception from db.transaction(undefined) | 241 Expecting exception from db.transaction(undefined) |
217 PASS Exception was thrown. | 242 PASS Exception was thrown. |
218 PASS code is DOMException.NOT_FOUND_ERR | 243 PASS code is DOMException.NOT_FOUND_ERR |
219 PASS ename is 'NotFoundError' | 244 PASS ename is 'NotFoundError' |
| 245 Exception message: One of the specified object stores was not found. |
220 request = newConnection() | 246 request = newConnection() |
221 indexedDB.open(dbname, 8) | 247 indexedDB.open(dbname, 8) |
222 db.createObjectStore('null') | 248 db.createObjectStore('null') |
223 db.createObjectStore('undefined') | 249 db.createObjectStore('undefined') |
224 PASS transaction = db.transaction(null) did not throw exception. | 250 PASS transaction = db.transaction(null) did not throw exception. |
225 PASS transaction.objectStore('null') is non-null. | 251 PASS transaction.objectStore('null') is non-null. |
226 PASS transaction = db.transaction(undefined) did not throw exception. | 252 PASS transaction = db.transaction(undefined) did not throw exception. |
227 PASS transaction.objectStore('undefined') is non-null. | 253 PASS transaction.objectStore('undefined') is non-null. |
228 PASS successfullyParsed is true | 254 PASS successfullyParsed is true |
229 | 255 |
230 TEST COMPLETE | 256 TEST COMPLETE |
231 | 257 |
OLD | NEW |