blob: 2bf154f796fc6dce0b5c6017179a17116f58c283 [file] [log] [blame]
Test IndexedDB's IDBCursor.continue() with a key parameter.
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)
db.createObjectStore('someObjectStore')
objectStore.createIndex('someIndex', 'x')
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
objectStore.add({'x': testData[nextToAdd]}, nextToAdd)
indexObject.openKeyCursor(null, 'next')
PASS event.target.result.primaryKey is 0
event.target.result.continue(3.14159)
PASS event.target.result.primaryKey is 3
event.target.result.continue()
PASS event.target.result.primaryKey is 4
event.target.result.continue()
PASS event.target.result.primaryKey is 5
event.target.result.continue(12)
PASS event.target.result.primaryKey is 7
event.target.result.continue(date)
PASS event.target.result.primaryKey is 9
event.target.result.continue()
PASS event.target.result.primaryKey is 10
event.target.result.continue()
PASS event.target.result.primaryKey is 11
event.target.result.continue('A bit1')
PASS event.target.result.primaryKey is 14
event.target.result.continue('A bit3')
PASS event.target.result.primaryKey is 16
event.target.result.continue('the BIGGEST string')
PASS event.target.result.primaryKey is 17
event.target.result.continue()
PASS event.target.result is null
indexObject.openKeyCursor(null, 'prev')
PASS event.target.result.primaryKey is 17
event.target.result.continue('A bit2')
PASS event.target.result.primaryKey is 15
event.target.result.continue()
PASS event.target.result.primaryKey is 14
event.target.result.continue(date)
PASS event.target.result.primaryKey is 10
event.target.result.continue()
PASS event.target.result.primaryKey is 9
event.target.result.continue(1)
PASS event.target.result.primaryKey is 2
event.target.result.continue()
PASS event.target.result.primaryKey is 1
event.target.result.continue()
PASS event.target.result.primaryKey is 0
event.target.result.continue()
PASS event.target.result is null
indexObject.openKeyCursor(null, 'next')
PASS event.target.result.primaryKey is 0
event.target.result.continue(3.14159)
PASS event.target.result.primaryKey is 3
Expecting exception from event.target.result.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.
indexObject.openKeyCursor(null, 'next')
PASS event.target.result.primaryKey is 0
event.target.result.continue(3.14159)
PASS event.target.result.primaryKey is 3
Expecting exception from event.target.result.continue(3.14159)
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.
indexObject.openKeyCursor(null, 'prev')
PASS event.target.result.primaryKey is 17
event.target.result.continue('A bit2')
PASS event.target.result.primaryKey is 15
Expecting exception from event.target.result.continue('A bit3')
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.
indexObject.openKeyCursor(null, 'prev')
PASS event.target.result.primaryKey is 17
event.target.result.continue('A bit2')
PASS event.target.result.primaryKey is 15
cursor = event.target.result
Expecting exception from event.target.result.continue('A bit2')
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.
Expecting exception from cursor.continue()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.
PASS successfullyParsed is true
TEST COMPLETE