blob: c61ecd7f774baae72301f5164d9a085fc3daecc7 [file] [log] [blame]
Test mutating an IndexedDB's objectstore from a cursor.
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)
objectStore = db.createObjectStore('store')
objectStore.add(1, 1).onerror = unexpectedErrorCallback
objectStore.add(2, 2).onerror = unexpectedErrorCallback
objectStore.add(3, 3).onerror = unexpectedErrorCallback
objectStore.add(4, 4).onerror = unexpectedErrorCallback
openForwardCursor()
trans = db.transaction(['store'], 'readwrite')
trans.objectStore('store')
objectStore.openCursor()
forwardCursor()
1
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
event.target.source.add(5, 5)
cursor.continue()
forwardCursor()
2
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
forwardCursor()
3
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
forwardCursor()
4
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
forwardCursor()
5
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
forwardCursor()
PASS cursorSteps is 5
forwardCursorComplete()
openReverseCursor()
trans = db.transaction(['store'], 'readwrite')
trans.objectStore('store')
objectStore.openCursor(null, 'prev')
reverseCursor()
5
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
reverseCursor()
4
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
reverseCursor()
3
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
reverseCursor()
2
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
event.target.source.add(0, 0)
cursor.continue()
reverseCursor()
1
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
reverseCursor()
0
PASS cursor.key is cursorSteps
PASS cursor.value is cursorSteps
cursor.continue()
reverseCursor()
PASS cursorSteps is 0
reverseCursorComplete()
PASS successfullyParsed is true
TEST COMPLETE