blob: d3a15dfef73ede8e961b6b6e49871167c0435900 [file] [log] [blame]
Test that continue() calls against cursors are validated by direction.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "cursor-continue-dir.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
store = db.createObjectStore('store')
store.put(1,1)
store.put(2,2)
store.put(3,3)
store.put(4,4)
store.put(5,5)
store.put(6,6)
store.put(7,7)
store.put(8,8)
store.put(9,9)
store.put(10,10)
trans = db.transaction('store')
store = trans.objectStore('store')
request = store.openCursor(IDBKeyRange.bound(-Infinity, Infinity), 'next')
cursor = request.result
PASS cursor is non-null.
Expect DataError if: The parameter is less than or equal to this cursor's position and this cursor's direction is "next" or "nextunique".
PASS cursor.key is 1
Expecting exception from cursor.continue(-1)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.
request = store.openCursor(IDBKeyRange.bound(-Infinity, Infinity), 'prev')
cursor = request.result
PASS cursor is non-null.
Expect DataError if: The parameter is greater than or equal to this cursor's position and this cursor's direction is "prev" or "prevunique".
PASS cursor.key is 10
Expecting exception from cursor.continue(11)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.
PASS successfullyParsed is true
TEST COMPLETE