blob: cd9fd40ea0f7c2962251d74bca9bc7e0e4ea5eaa [file] [log] [blame]
Test IndexedDB's openCursor.
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)
trans = event.target.transaction
PASS trans is non-null.
objectStore = db.createObjectStore('test')
objectStore.createIndex('testIndex', 'x')
objectStore.add({x: 1}, 'myKey1')
objectStore.add({x: 2}, 'myKey2')
objectStore.add({x: 3}, 'myKey3')
objectStore.add({x: 4}, 'myKey4')
openCursor1
trans = db.transaction(['test'], 'readwrite')
trans.objectStore('test').index('testIndex').openCursor(keyRange)
event.target.result.delete()
PASS event.target.result.key is counter++
event.target.result.continue()
event.target.result.delete()
PASS event.target.result.key is counter++
event.target.result.continue()
event.target.result.delete()
PASS event.target.result.key is counter++
event.target.result.continue()
event.target.result.delete()
PASS event.target.result.key is counter++
event.target.result.continue()
PASS counter is 5
trans.objectStore('test').index('testIndex').openCursor(keyRange)
PASS event.target.result is null
trans = db.transaction(['test'], 'readwrite')
objectStore = trans.objectStore('test')
objectStore.add({x: 1}, 'myKey1')
openCursor2
index = event.target.source.index('testIndex')
index.openCursor(keyRange)
PASS [object IDBCursorWithValue] is non-null.
event.target.result.delete()
index.get(1)
PASS event.target.result is undefined
PASS successfullyParsed is true
TEST COMPLETE