OLD | NEW |
1 Test features of IndexedDB's multiEntry indices. | 1 Test features of IndexedDB's multiEntry indices. |
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 = "index-multientry.html" | 8 dbname = "index-multientry.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 Verifying unique constraint on multiEntry index | 92 Verifying unique constraint on multiEntry index |
93 transaction = db.transaction(['store-unique'], 'readwrite') | 93 transaction = db.transaction(['store-unique'], 'readwrite') |
94 transaction.objectStore('store-unique').put({x: [1, 2, 3], y: 'a'}, 'foo') | 94 transaction.objectStore('store-unique').put({x: [1, 2, 3], y: 'a'}, 'foo') |
95 success! | 95 success! |
96 Replace an existing record - this should work | 96 Replace an existing record - this should work |
97 transaction.objectStore('store-unique').put({x: [1, 2, 7], y: 'a'}, 'foo') | 97 transaction.objectStore('store-unique').put({x: [1, 2, 7], y: 'a'}, 'foo') |
98 success! | 98 success! |
99 This should fail the uniqueness constraint on the index, and fail: | 99 This should fail the uniqueness constraint on the index, and fail: |
100 transaction.objectStore('store-unique').put({x: [5, 2], y: 'c'}, 'should fail') | 100 transaction.objectStore('store-unique').put({x: [5, 2], y: 'c'}, 'should fail') |
| 101 PASS request.result is undefined. |
| 102 PASS request.error is non-null. |
101 Request failed, as expected (ConstraintError) | 103 Request failed, as expected (ConstraintError) |
102 Transaction aborted as expected | 104 Transaction aborted as expected |
103 | 105 |
104 Create an index on a populated store | 106 Create an index on a populated store |
105 db.close() | 107 db.close() |
106 indexedDB.open(dbname, 2) | 108 indexedDB.open(dbname, 2) |
107 db = event.target.result | 109 db = event.target.result |
108 trans = event.target.transaction | 110 trans = event.target.transaction |
109 store = trans.objectStore('store') | 111 store = trans.objectStore('store') |
110 store.createIndex('index-new', 'x', {multiEntry: true}) | 112 store.createIndex('index-new', 'x', {multiEntry: true}) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 transaction = db.transaction(['store']) | 173 transaction = db.transaction(['store']) |
172 transaction.objectStore('store').index('index') | 174 transaction.objectStore('store').index('index') |
173 index.count() | 175 index.count() |
174 PASS event.target.result is 9 | 176 PASS event.target.result is 9 |
175 index.count(7) | 177 index.count(7) |
176 PASS event.target.result is 1 | 178 PASS event.target.result is 1 |
177 PASS successfullyParsed is true | 179 PASS successfullyParsed is true |
178 | 180 |
179 TEST COMPLETE | 181 TEST COMPLETE |
180 | 182 |
OLD | NEW |