1 Test IndexedDB primary key ordering and readback from cursors.
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 dbname = "cursor-primary-key-order.html"
7 indexedDB.deleteDatabase(dbname)
9 store = db.createObjectStore('store')
10 index = store.createIndex('index', 'indexKey')
13 trans = db.transaction('store', 'readwrite')
14 store = trans.objectStore('store');
15 store.put({"indexKey":0,"count":0}, 'c')
16 store.put({"indexKey":0,"count":1}, 'b')
17 store.put({"indexKey":0,"count":2}, 'a')
18 store.put({"indexKey":0,"count":3}, 'C')
19 store.put({"indexKey":0,"count":4}, 'B')
20 store.put({"indexKey":0,"count":5}, 'A')
21 store.put({"indexKey":0,"count":6}, '2')
22 store.put({"indexKey":0,"count":7}, '1')
23 store.put({"indexKey":0,"count":8}, '0')
24 store.put({"indexKey":0,"count":9}, Infinity)
25 store.put({"indexKey":0,"count":10}, 2)
26 store.put({"indexKey":0,"count":11}, 1)
27 store.put({"indexKey":0,"count":12}, 0)
28 store.put({"indexKey":0,"count":13}, -1)
29 store.put({"indexKey":0,"count":14}, -2)
30 store.put({"indexKey":0,"count":15}, -Infinity)
33 trans = db.transaction('store', 'readonly')
34 store = trans.objectStore('store');
35 index = store.index('index');
36 cursorRequest = index.openCursor()
38 cursor = cursorRequest.result
40 PASS cursor.primaryKey is -Infinity
41 cursor = cursorRequest.result
43 PASS cursor.primaryKey is -2
44 cursor = cursorRequest.result
46 PASS cursor.primaryKey is -1
47 cursor = cursorRequest.result
49 PASS cursor.primaryKey is 0
50 cursor = cursorRequest.result
52 PASS cursor.primaryKey is 1
53 cursor = cursorRequest.result
55 PASS cursor.primaryKey is 2
56 cursor = cursorRequest.result
58 PASS cursor.primaryKey is Infinity
59 cursor = cursorRequest.result
61 PASS cursor.primaryKey is '0'
62 cursor = cursorRequest.result
64 PASS cursor.primaryKey is '1'
65 cursor = cursorRequest.result
67 PASS cursor.primaryKey is '2'
68 cursor = cursorRequest.result
70 PASS cursor.primaryKey is 'A'
71 cursor = cursorRequest.result
73 PASS cursor.primaryKey is 'B'
74 cursor = cursorRequest.result
76 PASS cursor.primaryKey is 'C'
77 cursor = cursorRequest.result
79 PASS cursor.primaryKey is 'a'
80 cursor = cursorRequest.result
82 PASS cursor.primaryKey is 'b'
83 cursor = cursorRequest.result
85 PASS cursor.primaryKey is 'c'
86 PASS count is keys.length
87 PASS successfullyParsed is true