77 lines
2.4 KiB
Plaintext
77 lines
2.4 KiB
Plaintext
Ensure cursor calls behave as expected after cursor has run to the end.
|
|
|
|
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;
|
|
|
|
|
|
prepareDatabase():
|
|
indexedDB.deleteDatabase(dbname)
|
|
|
|
onDeleteSuccess():
|
|
indexedDB.open(dbname, 1)
|
|
|
|
onUpgradeNeeded():
|
|
db = event.target.result
|
|
store = db.createObjectStore('store')
|
|
store.put(1, 1)
|
|
store.put(2, 2)
|
|
|
|
onOpenSuccess():
|
|
db = event.target.result
|
|
transaction = db.transaction('store', 'readwrite')
|
|
store = transaction.objectStore('store')
|
|
count = 0
|
|
cursorRequest = store.openCursor()
|
|
|
|
onCursorSuccess():
|
|
cursor = event.target.result
|
|
PASS cursor is non-null.
|
|
count++
|
|
savedCursor = cursor
|
|
cursor.continue()
|
|
|
|
onCursorSuccess():
|
|
cursor = event.target.result
|
|
PASS cursor is non-null.
|
|
count++
|
|
savedCursor = cursor
|
|
cursor.continue()
|
|
|
|
onCursorSuccess():
|
|
cursor = event.target.result
|
|
PASS cursor is null
|
|
PASS savedCursor is non-null.
|
|
|
|
Expecting exception from savedCursor.update('value')
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'update' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
|
|
Expecting exception from savedCursor.advance(1)
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
|
|
Expecting exception from savedCursor.continue()
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
|
|
Expecting exception from savedCursor.continue('key')
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
|
|
Expecting exception from savedCursor.delete()
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'delete' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
|
|
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|