| OLD | NEW |
| (Empty) |
| 1 Test IndexedDB's IDBCursor.continue() with a primary key parameter. | |
| 2 | |
| 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | |
| 4 | |
| 5 | |
| 6 dbname = "cursor-continueprimarykey.html" | |
| 7 indexedDB.deleteDatabase(dbname) | |
| 8 indexedDB.open(dbname) | |
| 9 | |
| 10 prepareDatabase(): | |
| 11 db = event.target.result | |
| 12 store = db.createObjectStore('store') | |
| 13 index = store.createIndex('index', 'indexKey', {multiEntry: true}) | |
| 14 store.put({indexKey: ['a', 'b']}, 1) | |
| 15 store.put({indexKey: ['a', 'b']}, 2) | |
| 16 store.put({indexKey: ['a', 'b']}, 3) | |
| 17 store.put({indexKey: ['b']}, 4) | |
| 18 checking index structure... | |
| 19 | |
| 20 index key primary key | |
| 21 ========= =========== | |
| 22 a 1 | |
| 23 a 2 | |
| 24 a 3 | |
| 25 b 1 | |
| 26 b 2 | |
| 27 b 3 | |
| 28 b 4 | |
| 29 | |
| 30 Test case: cursor.continue() | |
| 31 | |
| 32 tx = db.transaction('store') | |
| 33 request = tx.objectStore('store').index('index').openCursor() | |
| 34 cursor.continue() | |
| 35 PASS cursor.key is "a" | |
| 36 PASS cursor.primaryKey is 2 | |
| 37 | |
| 38 Test case: cursor.continue('a') | |
| 39 | |
| 40 tx = db.transaction('store') | |
| 41 request = tx.objectStore('store').index('index').openCursor() | |
| 42 Expecting exception from cursor.continue('a') | |
| 43 PASS Exception was thrown. | |
| 44 PASS code is 0 | |
| 45 PASS ename is 'DataError' | |
| 46 Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is
less than or equal to this cursor's position. | |
| 47 | |
| 48 Test case: cursor.continue('b') | |
| 49 | |
| 50 tx = db.transaction('store') | |
| 51 request = tx.objectStore('store').index('index').openCursor() | |
| 52 cursor.continue('b') | |
| 53 PASS cursor.key is "b" | |
| 54 PASS cursor.primaryKey is 1 | |
| 55 | |
| 56 Test case: cursor.continue('c') | |
| 57 | |
| 58 tx = db.transaction('store') | |
| 59 request = tx.objectStore('store').index('index').openCursor() | |
| 60 cursor.continue('c') | |
| 61 PASS cursor is null | |
| 62 | |
| 63 Test case: cursor.continuePrimaryKey('a', 3) | |
| 64 | |
| 65 tx = db.transaction('store') | |
| 66 request = tx.objectStore('store').index('index').openCursor() | |
| 67 cursor.continuePrimaryKey('a', 3) | |
| 68 PASS cursor.key is "a" | |
| 69 PASS cursor.primaryKey is 3 | |
| 70 | |
| 71 Test case: cursor.continuePrimaryKey('a', 4) | |
| 72 | |
| 73 tx = db.transaction('store') | |
| 74 request = tx.objectStore('store').index('index').openCursor() | |
| 75 cursor.continuePrimaryKey('a', 4) | |
| 76 PASS cursor.key is "b" | |
| 77 PASS cursor.primaryKey is 1 | |
| 78 | |
| 79 Test case: cursor.continuePrimaryKey('b', 1) | |
| 80 | |
| 81 tx = db.transaction('store') | |
| 82 request = tx.objectStore('store').index('index').openCursor() | |
| 83 cursor.continuePrimaryKey('b', 1) | |
| 84 PASS cursor.key is "b" | |
| 85 PASS cursor.primaryKey is 1 | |
| 86 | |
| 87 Test case: cursor.continuePrimaryKey('b', 4) | |
| 88 | |
| 89 tx = db.transaction('store') | |
| 90 request = tx.objectStore('store').index('index').openCursor() | |
| 91 cursor.continuePrimaryKey('b', 4) | |
| 92 PASS cursor.key is "b" | |
| 93 PASS cursor.primaryKey is 4 | |
| 94 | |
| 95 Test case: cursor.continuePrimaryKey('b', 5) | |
| 96 | |
| 97 tx = db.transaction('store') | |
| 98 request = tx.objectStore('store').index('index').openCursor() | |
| 99 cursor.continuePrimaryKey('b', 5) | |
| 100 PASS cursor is null | |
| 101 | |
| 102 Test case: cursor.continuePrimaryKey('c', 1) | |
| 103 | |
| 104 tx = db.transaction('store') | |
| 105 request = tx.objectStore('store').index('index').openCursor() | |
| 106 cursor.continuePrimaryKey('c', 1) | |
| 107 PASS cursor is null | |
| 108 | |
| 109 Test case: cursor.continuePrimaryKey(null, 1) | |
| 110 | |
| 111 tx = db.transaction('store') | |
| 112 request = tx.objectStore('store').index('index').openCursor() | |
| 113 Expecting exception from cursor.continuePrimaryKey(null, 1) | |
| 114 PASS Exception was thrown. | |
| 115 PASS code is 0 | |
| 116 PASS ename is 'DataError' | |
| 117 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 118 | |
| 119 Test case: cursor.continuePrimaryKey(null, 2) | |
| 120 | |
| 121 tx = db.transaction('store') | |
| 122 request = tx.objectStore('store').index('index').openCursor() | |
| 123 Expecting exception from cursor.continuePrimaryKey(null, 2) | |
| 124 PASS Exception was thrown. | |
| 125 PASS code is 0 | |
| 126 PASS ename is 'DataError' | |
| 127 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 128 | |
| 129 Test case: cursor.continuePrimaryKey(null, 3) | |
| 130 | |
| 131 tx = db.transaction('store') | |
| 132 request = tx.objectStore('store').index('index').openCursor() | |
| 133 Expecting exception from cursor.continuePrimaryKey(null, 3) | |
| 134 PASS Exception was thrown. | |
| 135 PASS code is 0 | |
| 136 PASS ename is 'DataError' | |
| 137 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 138 | |
| 139 Test case: cursor.continuePrimaryKey(null, 4) | |
| 140 | |
| 141 tx = db.transaction('store') | |
| 142 request = tx.objectStore('store').index('index').openCursor() | |
| 143 Expecting exception from cursor.continuePrimaryKey(null, 4) | |
| 144 PASS Exception was thrown. | |
| 145 PASS code is 0 | |
| 146 PASS ename is 'DataError' | |
| 147 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 148 | |
| 149 Test case: cursor.continuePrimaryKey(null, 5) | |
| 150 | |
| 151 tx = db.transaction('store') | |
| 152 request = tx.objectStore('store').index('index').openCursor() | |
| 153 Expecting exception from cursor.continuePrimaryKey(null, 5) | |
| 154 PASS Exception was thrown. | |
| 155 PASS code is 0 | |
| 156 PASS ename is 'DataError' | |
| 157 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 158 | |
| 159 Test case: cursor.continuePrimaryKey('a', null) | |
| 160 | |
| 161 tx = db.transaction('store') | |
| 162 request = tx.objectStore('store').index('index').openCursor() | |
| 163 Expecting exception from cursor.continuePrimaryKey('a', null) | |
| 164 PASS Exception was thrown. | |
| 165 PASS code is 0 | |
| 166 PASS ename is 'DataError' | |
| 167 Exception message: Failed to execute 'continuePrimaryKey' on 'IDBCursor': The pa
rameter is not a valid key. | |
| 168 | |
| 169 PASS successfullyParsed is true | |
| 170 | |
| 171 TEST COMPLETE | |
| 172 | |
| OLD | NEW |