OLD | NEW |
1 Test IndexedDB's creating index with integer keys | 1 Test IndexedDB's creating index with integer keys |
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; | |
7 | |
8 dbname = "create-index-with-integer-keys.html" | 6 dbname = "create-index-with-integer-keys.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 objectStore = db.createObjectStore('foo', { keyPath: 'id' }); | 9 objectStore = db.createObjectStore('foo', { keyPath: 'id' }); |
12 data = { id: 16, num: 42 }; | 10 data = { id: 16, num: 42 }; |
13 objectStore.add(data); | 11 objectStore.add(data); |
14 index = objectStore.createIndex('foo', 'num'); | 12 index = objectStore.createIndex('foo', 'num'); |
15 result = index.openKeyCursor(); | 13 result = index.openKeyCursor(); |
16 cursor = event.target.result; | 14 cursor = event.target.result; |
17 PASS cursor == null is false | 15 PASS cursor == null is false |
18 PASS cursor.key is data.num | 16 PASS cursor.key is data.num |
19 PASS cursor.primaryKey is data.id | 17 PASS cursor.primaryKey is data.id |
20 PASS successfullyParsed is true | 18 PASS successfullyParsed is true |
21 | 19 |
22 TEST COMPLETE | 20 TEST COMPLETE |
23 | 21 |
OLD | NEW |