blob: def8967bc44d77793d97af4838600b14d14a4903 [file] [log] [blame]
Test the basics of IndexedDB's IDBCursor objects.
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)
prepareDatabase():
store = db.createObjectStore('storeName')
index = store.createIndex('indexName', 'indexOn')
store.put({indexOn: 'a'}, 0)
store.openCursor()
index.openCursor()
index.openKeyCursor()
onStoreOpenCursor():
cursor = event.target.result
PASS cursor is non-null.
PASS cursor instanceof IDBCursor is true
PASS 'key' in cursor is true
PASS 'primaryKey' in cursor is true
PASS 'continue' in cursor is true
PASS typeof cursor.continue is "function"
PASS 'continuePrimaryKey' in cursor is true
PASS typeof cursor.continuePrimaryKey is "function"
PASS 'advance' in cursor is true
PASS typeof cursor.advance is "function"
PASS 'update' in cursor is true
PASS typeof cursor.update is "function"
PASS 'delete' in cursor is true
PASS typeof cursor.delete is "function"
PASS cursor.key is 0
PASS cursor.primaryKey is 0
PASS cursor instanceof IDBCursorWithValue is true
PASS 'value' in cursor is true
PASS JSON.stringify(cursor.value) is "{\"indexOn\":\"a\"}"
onIndexOpenCursor():
cursor = event.target.result
PASS cursor is non-null.
PASS cursor instanceof IDBCursor is true
PASS 'key' in cursor is true
PASS 'primaryKey' in cursor is true
PASS 'continue' in cursor is true
PASS typeof cursor.continue is "function"
PASS 'continuePrimaryKey' in cursor is true
PASS typeof cursor.continuePrimaryKey is "function"
PASS 'advance' in cursor is true
PASS typeof cursor.advance is "function"
PASS 'update' in cursor is true
PASS typeof cursor.update is "function"
PASS 'delete' in cursor is true
PASS typeof cursor.delete is "function"
PASS cursor.key is "a"
PASS cursor.primaryKey is 0
PASS cursor instanceof IDBCursorWithValue is true
PASS 'value' in cursor is true
PASS JSON.stringify(cursor.value) is "{\"indexOn\":\"a\"}"
onIndexOpenKeyCursor():
cursor = event.target.result
PASS cursor is non-null.
PASS cursor instanceof IDBCursor is true
PASS 'key' in cursor is true
PASS 'primaryKey' in cursor is true
PASS 'continue' in cursor is true
PASS typeof cursor.continue is "function"
PASS 'continuePrimaryKey' in cursor is true
PASS typeof cursor.continuePrimaryKey is "function"
PASS 'advance' in cursor is true
PASS typeof cursor.advance is "function"
PASS 'update' in cursor is true
PASS typeof cursor.update is "function"
PASS 'delete' in cursor is true
PASS typeof cursor.delete is "function"
PASS cursor.key is "a"
PASS cursor.primaryKey is 0
PASS cursor instanceof IDBCursorWithValue is false
PASS cursor.primaryKey is 0
PASS 'value' in cursor is false
PASS successfullyParsed is true
TEST COMPLETE