1 [Worker] Test the basics of IndexedDB's IDBObjectStore.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 Starting worker: resources/objectstore-basics.js
7 [Worker] dbname = "objectstore-basics.js"
8 [Worker] indexedDB.deleteDatabase(dbname)
9 [Worker] indexedDB.open(dbname)
11 [Worker] prepareDatabase():
12 [Worker] store = db.createObjectStore('storeName', null)
13 [Worker] storeNames = db.objectStoreNames
14 PASS [Worker] 'name' in store is true
15 PASS [Worker] 'keyPath' in store is true
16 PASS [Worker] 'indexNames' in store is true
17 PASS [Worker] 'transaction' in store is true
18 PASS [Worker] 'autoIncrement' in store is true
19 PASS [Worker] 'put' in store is true
20 PASS [Worker] typeof store.put is "function"
21 PASS [Worker] 'add' in store is true
22 PASS [Worker] typeof store.add is "function"
23 PASS [Worker] 'delete' in store is true
24 PASS [Worker] typeof store.delete is "function"
25 PASS [Worker] 'get' in store is true
26 PASS [Worker] typeof store.get is "function"
27 PASS [Worker] 'clear' in store is true
28 PASS [Worker] typeof store.clear is "function"
29 PASS [Worker] 'openCursor' in store is true
30 PASS [Worker] typeof store.openCursor is "function"
31 PASS [Worker] 'openKeyCursor' in store is true
32 PASS [Worker] typeof store.openKeyCursor is "function"
33 PASS [Worker] 'createIndex' in store is true
34 PASS [Worker] typeof store.createIndex is "function"
35 PASS [Worker] 'index' in store is true
36 PASS [Worker] typeof store.index is "function"
37 PASS [Worker] 'deleteIndex' in store is true
38 PASS [Worker] typeof store.deleteIndex is "function"
39 PASS [Worker] 'count' in store is true
40 PASS [Worker] typeof store.count is "function"
41 PASS [Worker] store.name is "storeName"
42 PASS [Worker] store.keyPath is null
43 PASS [Worker] store.autoIncrement is false
44 PASS [Worker] storeNames.contains('storeName') is true
45 PASS [Worker] storeNames.length is 1
46 PASS [Worker] db.createObjectStore('storeWithKeyPath', {keyPath: 'path'}).keyPath is "path"
47 PASS [Worker] db.createObjectStore('storeWithKeyGenerator', {autoIncrement: true}).autoIncrement is true
48 [Worker] Ask for an index that doesn't exist:
49 [Worker] Expecting exception from store.index('asdf')
50 PASS [Worker] Exception was thrown.
51 PASS [Worker] code is DOMException.NOT_FOUND_ERR
52 PASS [Worker] ename is 'NotFoundError'
53 [Worker] Exception message: Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.
54 [Worker] createIndex():
55 [Worker] index = store.createIndex('indexName', 'x', {unique: true})
56 PASS [Worker] index is non-null.
57 PASS [Worker] store.indexNames.contains('indexName') is true
58 [Worker] index = store.index('indexName')
59 PASS [Worker] index is non-null.
60 [Worker] Ask for an index that doesn't exist:
61 [Worker] Expecting exception from store.index('asdf')
62 PASS [Worker] Exception was thrown.
63 PASS [Worker] code is DOMException.NOT_FOUND_ERR
64 PASS [Worker] ename is 'NotFoundError'
65 [Worker] Exception message: Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.
66 [Worker] indexedDB.open(dbname, 2)
68 PASS [Worker] db.version is 2
69 [Worker] setVersionTrans = event.target.transaction
70 PASS [Worker] setVersionTrans is non-null.
71 [Worker] store = setVersionTrans.objectStore('storeName')
72 [Worker] index = store.createIndex('indexFail', 'x')
73 PASS [Worker] db.version is 1
74 PASS [Worker] store.transaction is setVersionTrans
75 PASS [Worker] store.indexNames is ['indexName']
76 PASS [Worker] store.indexNames.length is 1
77 PASS [Worker] store.indexNames.contains('') is false
78 PASS [Worker] store.indexNames.contains('indexFail') is false
79 PASS [Worker] store.indexNames.contains('indexName') is true
80 PASS [Worker] store.indexNames[0] is "indexName"
81 PASS [Worker] store.indexNames[1] is undefined.
82 PASS [Worker] store.indexNames[100] is undefined.
83 PASS [Worker] store.indexNames.item(1) is null
84 PASS [Worker] store.indexNames.item(100) is null
87 [Worker] indexedDB.open(dbname)
90 [Worker] db = event.target.result
91 [Worker] transaction = db.transaction(['storeName'], 'readwrite')
92 [Worker] store = transaction.objectStore('storeName')
93 [Worker] Try to insert data with a Date key:
94 [Worker] store.add({x: 'foo'}, testDate)
95 [Worker] Try to insert a value not handled by structured clone:
96 [Worker] Expecting exception from store.add({x: 'bar', y: self}, 'bar')
97 PASS [Worker] Exception was thrown.
98 PASS [Worker] code is DOMException.DATA_CLONE_ERR
99 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': An object could not be cloned.
100 [Worker] Try to insert data where key path yields a Date key:
101 [Worker] store.add({x: testDateB, y: 'value'}, 'key')
102 [Worker] addSuccess():
103 PASS [Worker] event.target.result is "key"
104 [Worker] event.target.source.add({x: 'foo'}, 'zzz')
105 [Worker] addAgainFailure():
106 PASS [Worker] event.target.error.name is 'ConstraintError'
107 [Worker] event.preventDefault()
108 [Worker] db.transaction(['storeName'], 'readwrite')
109 [Worker] store = transaction.objectStore('storeName')
110 [Worker] store.add({x: 'somevalue'}, 'somekey')
111 [Worker] Expecting exception from store.add({x: 'othervalue'}, null)
112 PASS [Worker] Exception was thrown.
113 PASS [Worker] code is 0
114 PASS [Worker] ename is 'DataError'
115 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
116 [Worker] db.transaction(['storeName'], 'readwrite')
117 [Worker] store = transaction.objectStore('storeName')
118 [Worker] Ensure invalid key pointed at by index keyPath is ignored
119 [Worker] store.add({x: null}, 'validkey')
120 [Worker] db.transaction(['storeName'], 'readwrite')
121 [Worker] store = transaction.objectStore('storeName')
122 [Worker] store.get('key')
123 [Worker] getSuccess():
124 PASS [Worker] event.target.result.y is "value"
125 [Worker] store = event.target.source
126 [Worker] store.get(testDate)
127 [Worker] getSuccessDateKey():
128 PASS [Worker] event.target.result.x is "foo"
129 [Worker] store.delete('key')
130 [Worker] removeSuccess():
131 PASS [Worker] event.target.result is undefined
132 [Worker] store.delete('key')
133 [Worker] removeSuccessButNotThere():
134 PASS [Worker] event.target.result is undefined
135 [Worker] store = event.target.source
136 [Worker] Passing an invalid key into store.get().
137 [Worker] Expecting exception from store.get({})
138 PASS [Worker] Exception was thrown.
139 PASS [Worker] code is 0
140 PASS [Worker] ename is 'DataError'
141 [Worker] Exception message: Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.
142 [Worker] Passing an invalid key into store.delete().
143 [Worker] Expecting exception from store.delete({})
144 PASS [Worker] Exception was thrown.
145 PASS [Worker] code is 0
146 PASS [Worker] ename is 'DataError'
147 [Worker] Exception message: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.
148 [Worker] Passing an invalid key into store.add().
149 [Worker] Expecting exception from store.add(null, {})
150 PASS [Worker] Exception was thrown.
151 PASS [Worker] code is 0
152 PASS [Worker] ename is 'DataError'
153 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
154 [Worker] Passing an invalid key into store.put().
155 [Worker] Expecting exception from store.put(null, {})
156 PASS [Worker] Exception was thrown.
157 PASS [Worker] code is 0
158 PASS [Worker] ename is 'DataError'
159 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key.
161 [Worker] testPreConditions():
162 [Worker] indexedDB.open(dbname, 3)
164 [Worker] upgradeNeeded():
165 [Worker] storeWithInLineKeys = db.createObjectStore('storeWithInLineKeys', {keyPath: 'key'})
166 [Worker] storeWithOutOfLineKeys = db.createObjectStore('storeWithOutIOfLineKeys')
167 [Worker] storeWithIndex = db.createObjectStore('storeWithIndex')
168 [Worker] index = storeWithIndex.createIndex('indexName', 'indexKey')
170 [Worker] IDBObjectStore.put()
171 [Worker] The object store uses in-line keys and the key parameter was provided.
172 [Worker] Expecting exception from storeWithInLineKeys.put({key: 1}, 'key')
173 PASS [Worker] Exception was thrown.
174 PASS [Worker] code is 0
175 PASS [Worker] ename is 'DataError'
176 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store uses in-line keys and the key parameter was provided.
177 [Worker] The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
178 [Worker] Expecting exception from storeWithOutOfLineKeys.put({})
179 PASS [Worker] Exception was thrown.
180 PASS [Worker] code is 0
181 PASS [Worker] ename is 'DataError'
182 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
183 [Worker] The object store uses in-line keys and the result of evaluating the object store's key path yields a value and that value is not a valid key.
184 [Worker] Expecting exception from storeWithInLineKeys.put({key: null})
185 PASS [Worker] Exception was thrown.
186 PASS [Worker] code is 0
187 PASS [Worker] ename is 'DataError'
188 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path yielded a value that is not a valid key.
189 [Worker] The object store uses in-line keys but no key generator and the result of evaluating the object store's key path does not yield a value.
190 [Worker] Expecting exception from storeWithInLineKeys.put({})
191 PASS [Worker] Exception was thrown.
192 PASS [Worker] code is 0
193 PASS [Worker] ename is 'DataError'
194 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
195 [Worker] The key parameter was provided but does not contain a valid key.
196 [Worker] Expecting exception from storeWithOutOfLineKeys.put({}, null)
197 PASS [Worker] Exception was thrown.
198 PASS [Worker] code is 0
199 PASS [Worker] ename is 'DataError'
200 [Worker] Exception message: Failed to execute 'put' on 'IDBObjectStore': The parameter is not a valid key.
202 [Worker] IDBObjectStore.add()
203 [Worker] The object store uses in-line keys and the key parameter was provided.
204 [Worker] Expecting exception from storeWithInLineKeys.add({key: 1}, 'key')
205 PASS [Worker] Exception was thrown.
206 PASS [Worker] code is 0
207 PASS [Worker] ename is 'DataError'
208 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store uses in-line keys and the key parameter was provided.
209 [Worker] The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
210 [Worker] Expecting exception from storeWithOutOfLineKeys.add({})
211 PASS [Worker] Exception was thrown.
212 PASS [Worker] code is 0
213 PASS [Worker] ename is 'DataError'
214 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store uses out-of-line keys and has no key generator and the key parameter was not provided.
215 [Worker] The object store uses in-line keys and the result of evaluating the object store's key path yields a value and that value is not a valid key.
216 [Worker] Expecting exception from storeWithInLineKeys.add({key: null})
217 PASS [Worker] Exception was thrown.
218 PASS [Worker] code is 0
219 PASS [Worker] ename is 'DataError'
220 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path yielded a value that is not a valid key.
221 [Worker] The object store uses in-line keys but no key generator and the result of evaluating the object store's key path does not yield a value.
222 [Worker] Expecting exception from storeWithInLineKeys.add({})
223 PASS [Worker] Exception was thrown.
224 PASS [Worker] code is 0
225 PASS [Worker] ename is 'DataError'
226 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
227 [Worker] The key parameter was provided but does not contain a valid key.
228 [Worker] Expecting exception from storeWithOutOfLineKeys.add({}, null)
229 PASS [Worker] Exception was thrown.
230 PASS [Worker] code is 0
231 PASS [Worker] ename is 'DataError'
232 [Worker] Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is not a valid key.
233 PASS successfullyParsed is true