Verify that that cursors weakly hold request, and work if request is GC'd
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "cursor-request-cycle.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
prepareDatabase():
db = event.target.result
store = db.createObjectStore('store')
onOpen():
db = event.target.result
tx = db.transaction('store', 'readonly', {durability: 'relaxed'})
store = tx.objectStore('store')
cursorRequest = store.openCursor()
otherRequest = store.get(0)
openCursorRequestSuccess():
Result will be checked later, to ensure that lazy access is safe
otherRequestSuccess():
Verify that the request's result can be accessed lazily:
gc()
cursor = cursorRequest.result
PASS cursor is non-null.
PASS cursor.key is "key1"
PASS cursor.value is "value1"
cursorRequest.extra = 123
cursor.extra = 456
Ensure request is not released if cursor is still around.
cursorRequest = null
gc()
PASS cursorRequestObservation.wasCollected is false
cursor.continue()
cursor = null
gc()
PASS cursorObservation.wasCollected is false
finalRequest = store.get(0)
cursorContinueSuccess():
cursor = event.target.result
PASS cursor is non-null.
PASS cursor.key is "key2"
PASS cursor.value is "value2"
PASS event.target.extra is 123
PASS cursor.extra is 456
finalRequestSuccess():
PASS cursor.key is "key2"
PASS cursor.value is "value2"
cursor = null
PASS cursorRequestObservation.wasCollected is true
PASS cursorObservation.wasCollected is true
PASS successfullyParsed is true
TEST COMPLETE