OLD | NEW |
1 Verify that that cursors accessed after being closed are well behaved | 1 Verify that that cursors accessed after being closed are well behaved |
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 = "closed-cursor.html" | 6 dbname = "closed-cursor.html" |
9 indexedDB.deleteDatabase(dbname) | 7 indexedDB.deleteDatabase(dbname) |
10 indexedDB.open(dbname) | 8 indexedDB.open(dbname) |
11 | 9 |
12 prepareDatabase(): | 10 prepareDatabase(): |
13 db = event.target.result | 11 db = event.target.result |
14 store = db.createObjectStore('store') | 12 store = db.createObjectStore('store') |
15 store.put({value: 'value'}, ['key']) | 13 store.put({value: 'value'}, ['key']) |
16 | 14 |
17 onOpen(): | 15 onOpen(): |
18 db = event.target.result | 16 db = event.target.result |
19 tx = db.transaction('store') | 17 tx = db.transaction('store') |
20 store = tx.objectStore('store') | 18 store = tx.objectStore('store') |
21 cursorRequest = store.openCursor() | 19 cursorRequest = store.openCursor() |
22 | 20 |
23 openCursorSuccess(): | 21 openCursorSuccess(): |
24 cursor = cursorRequest.result | 22 cursor = cursorRequest.result |
25 Don't continue the cursor, so it retains its key/primaryKey/value | 23 Don't continue the cursor, so it retains its key/primaryKey/value |
26 | 24 |
27 transactionComplete(): | 25 transactionComplete(): |
28 PASS JSON.stringify(cursor.key) is "[\"key\"]" | 26 PASS JSON.stringify(cursor.key) is "[\"key\"]" |
29 PASS JSON.stringify(cursor.primaryKey) is "[\"key\"]" | 27 PASS JSON.stringify(cursor.primaryKey) is "[\"key\"]" |
30 PASS JSON.stringify(cursor.value) is "{\"value\":\"value\"}" | 28 PASS JSON.stringify(cursor.value) is "{\"value\":\"value\"}" |
31 PASS successfullyParsed is true | 29 PASS successfullyParsed is true |
32 | 30 |
33 TEST COMPLETE | 31 TEST COMPLETE |
34 | 32 |
OLD | NEW |