34 lines
929 B
Plaintext
34 lines
929 B
Plaintext
Verify that that cursors accessed after being closed are well behaved
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
|
|
|
|
indexedDB.deleteDatabase(dbname)
|
|
indexedDB.open(dbname)
|
|
|
|
prepareDatabase():
|
|
db = event.target.result
|
|
store = db.createObjectStore('store')
|
|
store.put({value: 'value'}, ['key'])
|
|
|
|
onOpen():
|
|
db = event.target.result
|
|
tx = db.transaction('store')
|
|
store = tx.objectStore('store')
|
|
cursorRequest = store.openCursor()
|
|
|
|
openCursorSuccess():
|
|
cursor = cursorRequest.result
|
|
Don't continue the cursor, so it retains its key/primaryKey/value
|
|
|
|
transactionComplete():
|
|
PASS JSON.stringify(cursor.key) is "[\"key\"]"
|
|
PASS JSON.stringify(cursor.primaryKey) is "[\"key\"]"
|
|
PASS JSON.stringify(cursor.value) is "{\"value\":\"value\"}"
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|