blob: 7282193e76dc68f183d0ab07ffbf742d195cc4e5 [file] [log] [blame]
[Worker] Test IndexedDB cursor.advance().
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Starting worker: resources/cursor-advance.js
[Worker] indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
[Worker]
[Worker] indexedDB.deleteDatabase(dbname)
[Worker] indexedDB.open(dbname)
[Worker]
[Worker] prepareDatabase():
[Worker] objectStore = db.createObjectStore(objectStoreName);
[Worker] Now create the indexes.
[Worker] objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);
[Worker] objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);
[Worker] objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);
[Worker] trans = db.transaction(objectStoreName, 'readwrite')
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] First, add all our data to the object store.
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
[Worker] testSimple()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor()
[Worker] cursor.advance(1)
PASS [Worker] expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
[Worker] testContinueThenAdvance()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor()
[Worker] cursor.continue();
[Worker] cursor.continue();
[Worker] cursor.continue();
[Worker] cursor.advance(1)
PASS [Worker] expected is "{\"key\":\"237-23-7736\",\"value\":{\"name\":\"Joe\",\"height\":65,\"weight\":150},\"primaryKey\":\"237-23-7736\"}"
[Worker] testAdvanceMultiple()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor()
[Worker] cursor.advance(3)
PASS [Worker] expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
[Worker] testAdvanceIndex()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor()
[Worker] cursor.advance(3)
PASS [Worker] expected is "{\"key\":\"Jef\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
[Worker] testAdvanceIndexNoDupe()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor(null, 'nextunique')
[Worker] cursor.advance(3)
PASS [Worker] expected is "{\"key\":130,\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
[Worker] testAdvanceIndexPrev()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor(null, 'prev')
[Worker] cursor.advance(3)
PASS [Worker] expected is "{\"key\":150,\"value\":{\"name\":\"Joe\",\"height\":65,\"weight\":150},\"primaryKey\":\"237-23-7736\"}"
[Worker] testAdvanceIndexPrevNoDupe()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor(null, 'prevunique')
[Worker] cursor.advance(3)
PASS [Worker] expected is "{\"key\":120,\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
[Worker] testAdvanceToEnd()
[Worker] trans = db.transaction(objectStoreName)
[Worker] store = trans.objectStore(objectStoreName)
[Worker] request = store.openCursor()
[Worker] cursor.advance(100)
PASS [Worker] expected is "null"
[Worker] testPrefetchInRange()
[Worker] trans = db.transaction(objectStoreName)
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] request = objectStore.openCursor()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
[Worker] cursor.advance(2)
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7737\",\"value\":{\"name\":\"Pat\",\"height\":65,\"weight\":100},\"primaryKey\":\"237-23-7737\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7738\",\"value\":{\"name\":\"Leo\",\"height\":65,\"weight\":180},\"primaryKey\":\"237-23-7738\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7739\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7740\",\"value\":{\"name\":\"Sam\",\"height\":71,\"weight\":110},\"primaryKey\":\"237-23-7740\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7741\",\"value\":{\"name\":\"Bug\",\"height\":63,\"weight\":100},\"primaryKey\":\"237-23-7741\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
[Worker] testPrefetchOutOfRange()
[Worker] trans = db.transaction(objectStoreName)
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] request = objectStore.openCursor()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7735\",\"value\":{\"name\":\"Sue\",\"height\":58,\"weight\":130},\"primaryKey\":\"237-23-7735\"}"
[Worker] cursor.advance(7)
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
PASS [Worker] expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
[Worker] cursor.continue()
[Worker]
[Worker] prefetch():
[Worker] testBadAdvance()
[Worker] trans = db.transaction(objectStoreName, 'readwrite')
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] request = objectStore.openCursor()
[Worker]
[Worker] advanceBadly():
[Worker] Expecting TypeError exception from cursor.advance(0)
PASS [Worker] Exception was thrown.
PASS [Worker] cursor.advance(0) threw TypeError: Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.
[Worker] Expecting TypeError exception from cursor.advance(-1)
PASS [Worker] Exception was thrown.
PASS [Worker] cursor.advance(-1) threw TypeError: Value -1 is outside the range [0, 4294967295]
[Worker] Expecting TypeError exception from cursor.advance(0x100000000)
PASS [Worker] Exception was thrown.
PASS [Worker] cursor.advance(0x100000000) threw TypeError: Value 4294967296 is outside the range [0, 4294967295]
[Worker] Expecting TypeError exception from cursor.advance(0x20000000000000)
PASS [Worker] Exception was thrown.
PASS [Worker] cursor.advance(0x20000000000000) threw TypeError: Value 9007199254740992 is outside the range [0, 4294967295]
[Worker]
[Worker] testEdges():
[Worker] trans = db.transaction(objectStoreName, 'readonly')
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] request = objectStore.openCursor()
[Worker]
[Worker] onSuccess():
[Worker] cursor = event.target.result
PASS [Worker] cursor is non-null.
[Worker] cursor.advance(0xffffffff)
[Worker]
[Worker] onSuccess():
[Worker] cursor = event.target.result
PASS [Worker] cursor is null
[Worker] testDelete()
[Worker] trans = db.transaction(objectStoreName, 'readwrite')
[Worker] objectStore = trans.objectStore(objectStoreName)
[Worker] request = objectStore.openCursor()
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7732\",\"value\":{\"name\":\"Bob\",\"height\":60,\"weight\":120},\"primaryKey\":\"237-23-7732\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7733\",\"value\":{\"name\":\"Ann\",\"height\":52,\"weight\":110},\"primaryKey\":\"237-23-7733\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7734\",\"value\":{\"name\":\"Ron\",\"height\":73,\"weight\":180},\"primaryKey\":\"237-23-7734\"}"
[Worker] cursor.delete()
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7738\",\"value\":{\"name\":\"Leo\",\"height\":65,\"weight\":180},\"primaryKey\":\"237-23-7738\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7739\",\"value\":{\"name\":\"Jef\",\"height\":65,\"weight\":120},\"primaryKey\":\"237-23-7739\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7740\",\"value\":{\"name\":\"Sam\",\"height\":71,\"weight\":110},\"primaryKey\":\"237-23-7740\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7741\",\"value\":{\"name\":\"Bug\",\"height\":63,\"weight\":100},\"primaryKey\":\"237-23-7741\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7742\",\"value\":{\"name\":\"Tub\",\"height\":69,\"weight\":180},\"primaryKey\":\"237-23-7742\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7743\",\"value\":{\"name\":\"Rug\",\"height\":77,\"weight\":120},\"primaryKey\":\"237-23-7743\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS [Worker] expected is "{\"key\":\"237-23-7744\",\"value\":{\"name\":\"Pug\",\"height\":66,\"weight\":110},\"primaryKey\":\"237-23-7744\"}"
[Worker] cursor.advance(1)
[Worker]
[Worker] deleteSecond():
PASS successfullyParsed is true
TEST COMPLETE