OLD | NEW |
1 Test the basics of IndexedDB's IDBObjectStore. | 1 Test the basics of IndexedDB's IDBObjectStore. |
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 = "objectstore-basics.html" | 8 dbname = "objectstore-basics.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 addData(): | 90 addData(): |
91 db = event.target.result | 91 db = event.target.result |
92 transaction = db.transaction(['storeName'], 'readwrite') | 92 transaction = db.transaction(['storeName'], 'readwrite') |
93 store = transaction.objectStore('storeName') | 93 store = transaction.objectStore('storeName') |
94 Try to insert data with a Date key: | 94 Try to insert data with a Date key: |
95 store.add({x: 'foo'}, testDate) | 95 store.add({x: 'foo'}, testDate) |
96 Try to insert a value not handled by structured clone: | 96 Try to insert a value not handled by structured clone: |
97 Expecting exception from store.add({x: 'bar', y: self}, 'bar') | 97 Expecting exception from store.add({x: 'bar', y: self}, 'bar') |
98 PASS Exception was thrown. | 98 PASS Exception was thrown. |
99 PASS code is DOMException.DATA_CLONE_ERR | 99 PASS code is DOMException.DATA_CLONE_ERR |
100 Exception message: An object could not be cloned. | 100 Exception message: Failed to execute 'add' on 'IDBObjectStore': An object could
not be cloned. |
101 Try to insert data where key path yields a Date key: | 101 Try to insert data where key path yields a Date key: |
102 store.add({x: testDateB, y: 'value'}, 'key') | 102 store.add({x: testDateB, y: 'value'}, 'key') |
103 addSuccess(): | 103 addSuccess(): |
104 PASS event.target.result is "key" | 104 PASS event.target.result is "key" |
105 event.target.source.add({x: 'foo'}, 'zzz') | 105 event.target.source.add({x: 'foo'}, 'zzz') |
106 addAgainFailure(): | 106 addAgainFailure(): |
107 PASS event.target.error.name is 'ConstraintError' | 107 PASS event.target.error.name is 'ConstraintError' |
108 event.preventDefault() | 108 event.preventDefault() |
109 db.transaction(['storeName'], 'readwrite') | 109 db.transaction(['storeName'], 'readwrite') |
110 store = transaction.objectStore('storeName') | 110 store = transaction.objectStore('storeName') |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 The key parameter was provided but does not contain a valid key. | 228 The key parameter was provided but does not contain a valid key. |
229 Expecting exception from storeWithOutOfLineKeys.add({}, null) | 229 Expecting exception from storeWithOutOfLineKeys.add({}, null) |
230 PASS Exception was thrown. | 230 PASS Exception was thrown. |
231 PASS code is 0 | 231 PASS code is 0 |
232 PASS ename is 'DataError' | 232 PASS ename is 'DataError' |
233 Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is
not a valid key. | 233 Exception message: Failed to execute 'add' on 'IDBObjectStore': The parameter is
not a valid key. |
234 PASS successfullyParsed is true | 234 PASS successfullyParsed is true |
235 | 235 |
236 TEST COMPLETE | 236 TEST COMPLETE |
237 | 237 |
OLD | NEW |