OLD | NEW |
1 Test IndexedDB cursor behavior | 1 Test IndexedDB cursor behavior |
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 = "cursors.html" | 8 dbname = "cursors.html" |
9 indexedDB.deleteDatabase(dbname) | 9 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 10 indexedDB.open(dbname) |
(...skipping 24 matching lines...) Expand all Loading... |
35 request = objectStore.add('foo', keys[i]); | 35 request = objectStore.add('foo', keys[i]); |
36 request = objectStore.openCursor(); | 36 request = objectStore.openCursor(); |
37 cursor = event.target.result; | 37 cursor = event.target.result; |
38 PASS cursor.key is sortedKeys[keyIndex] | 38 PASS cursor.key is sortedKeys[keyIndex] |
39 PASS cursor.primaryKey is sortedKeys[keyIndex] | 39 PASS cursor.primaryKey is sortedKeys[keyIndex] |
40 PASS cursor.value is 'foo' | 40 PASS cursor.value is 'foo' |
41 cursor.continue(); | 41 cursor.continue(); |
42 Expecting exception from cursor.continue(); | 42 Expecting exception from cursor.continue(); |
43 PASS Exception was thrown. | 43 PASS Exception was thrown. |
44 PASS code is DOMException.INVALID_STATE_ERR | 44 PASS code is DOMException.INVALID_STATE_ERR |
| 45 Exception message: The cursor is being iterated or has iterated past its end. |
45 PASS cursor.key is sortedKeys[keyIndex] | 46 PASS cursor.key is sortedKeys[keyIndex] |
46 PASS cursor.primaryKey is sortedKeys[keyIndex] | 47 PASS cursor.primaryKey is sortedKeys[keyIndex] |
47 PASS cursor.value is 'foo' | 48 PASS cursor.value is 'foo' |
48 keyIndex++; | 49 keyIndex++; |
49 cursor = event.target.result; | 50 cursor = event.target.result; |
50 PASS cursor.key is sortedKeys[keyIndex] | 51 PASS cursor.key is sortedKeys[keyIndex] |
51 PASS cursor.primaryKey is sortedKeys[keyIndex] | 52 PASS cursor.primaryKey is sortedKeys[keyIndex] |
52 PASS cursor.value is 'foo' | 53 PASS cursor.value is 'foo' |
53 cursor.continue(); | 54 cursor.continue(); |
54 Expecting exception from cursor.continue(); | 55 Expecting exception from cursor.continue(); |
55 PASS Exception was thrown. | 56 PASS Exception was thrown. |
56 PASS code is DOMException.INVALID_STATE_ERR | 57 PASS code is DOMException.INVALID_STATE_ERR |
| 58 Exception message: The cursor is being iterated or has iterated past its end. |
57 PASS cursor.key is sortedKeys[keyIndex] | 59 PASS cursor.key is sortedKeys[keyIndex] |
58 PASS cursor.primaryKey is sortedKeys[keyIndex] | 60 PASS cursor.primaryKey is sortedKeys[keyIndex] |
59 PASS cursor.value is 'foo' | 61 PASS cursor.value is 'foo' |
60 keyIndex++; | 62 keyIndex++; |
61 cursor = event.target.result; | 63 cursor = event.target.result; |
62 PASS cursor.key is sortedKeys[keyIndex] | 64 PASS cursor.key is sortedKeys[keyIndex] |
63 PASS cursor.primaryKey is sortedKeys[keyIndex] | 65 PASS cursor.primaryKey is sortedKeys[keyIndex] |
64 PASS cursor.value is 'foo' | 66 PASS cursor.value is 'foo' |
65 cursor.continue(); | 67 cursor.continue(); |
66 Expecting exception from cursor.continue(); | 68 Expecting exception from cursor.continue(); |
67 PASS Exception was thrown. | 69 PASS Exception was thrown. |
68 PASS code is DOMException.INVALID_STATE_ERR | 70 PASS code is DOMException.INVALID_STATE_ERR |
| 71 Exception message: The cursor is being iterated or has iterated past its end. |
69 PASS cursor.key is sortedKeys[keyIndex] | 72 PASS cursor.key is sortedKeys[keyIndex] |
70 PASS cursor.primaryKey is sortedKeys[keyIndex] | 73 PASS cursor.primaryKey is sortedKeys[keyIndex] |
71 PASS cursor.value is 'foo' | 74 PASS cursor.value is 'foo' |
72 keyIndex++; | 75 keyIndex++; |
73 cursor = event.target.result; | 76 cursor = event.target.result; |
74 PASS cursor.key is sortedKeys[keyIndex] | 77 PASS cursor.key is sortedKeys[keyIndex] |
75 PASS cursor.primaryKey is sortedKeys[keyIndex] | 78 PASS cursor.primaryKey is sortedKeys[keyIndex] |
76 PASS cursor.value is 'foo' | 79 PASS cursor.value is 'foo' |
77 cursor.continue(); | 80 cursor.continue(); |
78 Expecting exception from cursor.continue(); | 81 Expecting exception from cursor.continue(); |
79 PASS Exception was thrown. | 82 PASS Exception was thrown. |
80 PASS code is DOMException.INVALID_STATE_ERR | 83 PASS code is DOMException.INVALID_STATE_ERR |
| 84 Exception message: The cursor is being iterated or has iterated past its end. |
81 PASS cursor.key is sortedKeys[keyIndex] | 85 PASS cursor.key is sortedKeys[keyIndex] |
82 PASS cursor.primaryKey is sortedKeys[keyIndex] | 86 PASS cursor.primaryKey is sortedKeys[keyIndex] |
83 PASS cursor.value is 'foo' | 87 PASS cursor.value is 'foo' |
84 keyIndex++; | 88 keyIndex++; |
85 cursor = event.target.result; | 89 cursor = event.target.result; |
86 PASS cursor.key is sortedKeys[keyIndex] | 90 PASS cursor.key is sortedKeys[keyIndex] |
87 PASS cursor.primaryKey is sortedKeys[keyIndex] | 91 PASS cursor.primaryKey is sortedKeys[keyIndex] |
88 PASS cursor.value is 'foo' | 92 PASS cursor.value is 'foo' |
89 cursor.continue(); | 93 cursor.continue(); |
90 Expecting exception from cursor.continue(); | 94 Expecting exception from cursor.continue(); |
91 PASS Exception was thrown. | 95 PASS Exception was thrown. |
92 PASS code is DOMException.INVALID_STATE_ERR | 96 PASS code is DOMException.INVALID_STATE_ERR |
| 97 Exception message: The cursor is being iterated or has iterated past its end. |
93 PASS cursor.key is sortedKeys[keyIndex] | 98 PASS cursor.key is sortedKeys[keyIndex] |
94 PASS cursor.primaryKey is sortedKeys[keyIndex] | 99 PASS cursor.primaryKey is sortedKeys[keyIndex] |
95 PASS cursor.value is 'foo' | 100 PASS cursor.value is 'foo' |
96 keyIndex++; | 101 keyIndex++; |
97 cursor = event.target.result; | 102 cursor = event.target.result; |
98 PASS cursor.key is sortedKeys[keyIndex] | 103 PASS cursor.key is sortedKeys[keyIndex] |
99 PASS cursor.primaryKey is sortedKeys[keyIndex] | 104 PASS cursor.primaryKey is sortedKeys[keyIndex] |
100 PASS cursor.value is 'foo' | 105 PASS cursor.value is 'foo' |
101 cursor.continue(); | 106 cursor.continue(); |
102 Expecting exception from cursor.continue(); | 107 Expecting exception from cursor.continue(); |
103 PASS Exception was thrown. | 108 PASS Exception was thrown. |
104 PASS code is DOMException.INVALID_STATE_ERR | 109 PASS code is DOMException.INVALID_STATE_ERR |
| 110 Exception message: The cursor is being iterated or has iterated past its end. |
105 PASS cursor.key is sortedKeys[keyIndex] | 111 PASS cursor.key is sortedKeys[keyIndex] |
106 PASS cursor.primaryKey is sortedKeys[keyIndex] | 112 PASS cursor.primaryKey is sortedKeys[keyIndex] |
107 PASS cursor.value is 'foo' | 113 PASS cursor.value is 'foo' |
108 keyIndex++; | 114 keyIndex++; |
109 cursor = event.target.result; | 115 cursor = event.target.result; |
110 PASS cursor.key is sortedKeys[keyIndex] | 116 PASS cursor.key is sortedKeys[keyIndex] |
111 PASS cursor.primaryKey is sortedKeys[keyIndex] | 117 PASS cursor.primaryKey is sortedKeys[keyIndex] |
112 PASS cursor.value is 'foo' | 118 PASS cursor.value is 'foo' |
113 cursor.continue(); | 119 cursor.continue(); |
114 Expecting exception from cursor.continue(); | 120 Expecting exception from cursor.continue(); |
115 PASS Exception was thrown. | 121 PASS Exception was thrown. |
116 PASS code is DOMException.INVALID_STATE_ERR | 122 PASS code is DOMException.INVALID_STATE_ERR |
| 123 Exception message: The cursor is being iterated or has iterated past its end. |
117 PASS cursor.key is sortedKeys[keyIndex] | 124 PASS cursor.key is sortedKeys[keyIndex] |
118 PASS cursor.primaryKey is sortedKeys[keyIndex] | 125 PASS cursor.primaryKey is sortedKeys[keyIndex] |
119 PASS cursor.value is 'foo' | 126 PASS cursor.value is 'foo' |
120 keyIndex++; | 127 keyIndex++; |
121 cursor = event.target.result; | 128 cursor = event.target.result; |
122 PASS cursor.key is sortedKeys[keyIndex] | 129 PASS cursor.key is sortedKeys[keyIndex] |
123 PASS cursor.primaryKey is sortedKeys[keyIndex] | 130 PASS cursor.primaryKey is sortedKeys[keyIndex] |
124 PASS cursor.value is 'foo' | 131 PASS cursor.value is 'foo' |
125 cursor.continue(); | 132 cursor.continue(); |
126 Expecting exception from cursor.continue(); | 133 Expecting exception from cursor.continue(); |
127 PASS Exception was thrown. | 134 PASS Exception was thrown. |
128 PASS code is DOMException.INVALID_STATE_ERR | 135 PASS code is DOMException.INVALID_STATE_ERR |
| 136 Exception message: The cursor is being iterated or has iterated past its end. |
129 PASS cursor.key is sortedKeys[keyIndex] | 137 PASS cursor.key is sortedKeys[keyIndex] |
130 PASS cursor.primaryKey is sortedKeys[keyIndex] | 138 PASS cursor.primaryKey is sortedKeys[keyIndex] |
131 PASS cursor.value is 'foo' | 139 PASS cursor.value is 'foo' |
132 keyIndex++; | 140 keyIndex++; |
133 cursor = event.target.result; | 141 cursor = event.target.result; |
134 PASS cursor.key is sortedKeys[keyIndex] | 142 PASS cursor.key is sortedKeys[keyIndex] |
135 PASS cursor.primaryKey is sortedKeys[keyIndex] | 143 PASS cursor.primaryKey is sortedKeys[keyIndex] |
136 PASS cursor.value is 'foo' | 144 PASS cursor.value is 'foo' |
137 cursor.continue(); | 145 cursor.continue(); |
138 Expecting exception from cursor.continue(); | 146 Expecting exception from cursor.continue(); |
139 PASS Exception was thrown. | 147 PASS Exception was thrown. |
140 PASS code is DOMException.INVALID_STATE_ERR | 148 PASS code is DOMException.INVALID_STATE_ERR |
| 149 Exception message: The cursor is being iterated or has iterated past its end. |
141 PASS cursor.key is sortedKeys[keyIndex] | 150 PASS cursor.key is sortedKeys[keyIndex] |
142 PASS cursor.primaryKey is sortedKeys[keyIndex] | 151 PASS cursor.primaryKey is sortedKeys[keyIndex] |
143 PASS cursor.value is 'foo' | 152 PASS cursor.value is 'foo' |
144 keyIndex++; | 153 keyIndex++; |
145 cursor = event.target.result; | 154 cursor = event.target.result; |
146 PASS cursor.key is sortedKeys[keyIndex] | 155 PASS cursor.key is sortedKeys[keyIndex] |
147 PASS cursor.primaryKey is sortedKeys[keyIndex] | 156 PASS cursor.primaryKey is sortedKeys[keyIndex] |
148 PASS cursor.value is 'foo' | 157 PASS cursor.value is 'foo' |
149 cursor.continue(); | 158 cursor.continue(); |
150 Expecting exception from cursor.continue(); | 159 Expecting exception from cursor.continue(); |
151 PASS Exception was thrown. | 160 PASS Exception was thrown. |
152 PASS code is DOMException.INVALID_STATE_ERR | 161 PASS code is DOMException.INVALID_STATE_ERR |
| 162 Exception message: The cursor is being iterated or has iterated past its end. |
153 PASS cursor.key is sortedKeys[keyIndex] | 163 PASS cursor.key is sortedKeys[keyIndex] |
154 PASS cursor.primaryKey is sortedKeys[keyIndex] | 164 PASS cursor.primaryKey is sortedKeys[keyIndex] |
155 PASS cursor.value is 'foo' | 165 PASS cursor.value is 'foo' |
156 keyIndex++; | 166 keyIndex++; |
157 cursor = event.target.result; | 167 cursor = event.target.result; |
158 PASS keyIndex is keys.length | 168 PASS keyIndex is keys.length |
159 keyIndex = 4; | 169 keyIndex = 4; |
160 range = IDBKeyRange.bound(2000, 'q'); | 170 range = IDBKeyRange.bound(2000, 'q'); |
161 request = objectStore.openCursor(range); | 171 request = objectStore.openCursor(range); |
162 cursor = event.target.result; | 172 cursor = event.target.result; |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 PASS cursor.key is sortedKeys[keyIndex] | 600 PASS cursor.key is sortedKeys[keyIndex] |
591 PASS cursor.primaryKey is sortedKeys[keyIndex] | 601 PASS cursor.primaryKey is sortedKeys[keyIndex] |
592 PASS cursor.value is 'foo' | 602 PASS cursor.value is 'foo' |
593 keyIndex--; | 603 keyIndex--; |
594 cursor = event.target.result; | 604 cursor = event.target.result; |
595 PASS keyIndex is -1 | 605 PASS keyIndex is -1 |
596 PASS successfullyParsed is true | 606 PASS successfullyParsed is true |
597 | 607 |
598 TEST COMPLETE | 608 TEST COMPLETE |
599 | 609 |
OLD | NEW |