blob: ea6a3654184601c8be276940cee86ac992314741 [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)
setVersionSuccess():
trans = event.target.result
PASS trans is non-null.
objectStore = db.createObjectStore('test')
objectStore.add('myValue1', 'myKey1')
objectStore.add('myValue2', 'myKey2')
objectStore.add('myValue3', 'myKey3')
objectStore.add('myValue4', 'myKey4')
openCursor1
trans = db.transaction(['test'], 'readwrite')
trans.objectStore('test').openCursor(keyRange)
deleteRequest = event.target.result.delete()
PASS deleteRequest.source is event.target.result
PASS event.target.result.value is "myValue1"
event.target.result.continue()
deleteRequest = event.target.result.delete()
PASS deleteRequest.source is event.target.result
PASS event.target.result.value is "myValue2"
event.target.result.continue()
deleteRequest = event.target.result.delete()
PASS deleteRequest.source is event.target.result
PASS event.target.result.value is "myValue3"
event.target.result.continue()
deleteRequest = event.target.result.delete()
PASS deleteRequest.source is event.target.result
PASS event.target.result.value is "myValue4"
event.target.result.continue()
PASS counter is 5
trans.objectStore('test').openCursor(keyRange)
PASS event.target.result is null
trans = db.transaction(['test'], 'readwrite')
objectStore = trans.objectStore('test')
objectStore.add('myValue1', 'myKey1')
openCursor2
objectStore.openCursor(keyRange)
PASS [object IDBCursorWithValue] is non-null.
deleteRequest = event.target.result.delete()
PASS deleteRequest.source is event.target.result
objectStore.get('myKey1')
PASS event.target.result is undefined
PASS successfullyParsed is true
TEST COMPLETE