blob: 7bd681f1242e002f686a31bd2ffa1c24d1ca62b5 [file] [log] [blame]
Test IndexedDB's openCursor.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "open-cursor.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
objectStore = db.createObjectStore('test')
objectStore.add('myValue', 'myKey')
Opening cursor
event.target.source.openCursor(keyRange)
Cursor opened successfully.
PASS cursor.direction is "next"
PASS cursor.key is "myKey"
PASS cursor.value is "myValue"
Passing an invalid key into .continue({}).
Expecting exception from event.target.result.continue({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.
Opening an empty cursor.
objectStore.openCursor(keyRange)
Empty cursor opened successfully.
PASS cursor is null
Opening cursor
event.target.source.openCursor("myKey")
Cursor opened successfully.
PASS cursor.direction is "next"
PASS cursor.key is "myKey"
PASS cursor.value is "myValue"
Passing an invalid key into .continue({}).
Expecting exception from cursor.continue({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.
Opening an empty cursor.
objectStore.openCursor("InexistentKey")
Empty cursor opened successfully.
PASS cursor is null
PASS successfullyParsed is true
TEST COMPLETE