feb35a55f8693736f87615fc419bf4142d0e8214
2 <title>IDBCursor is reused
</title>
3 <link rel=
"author" href=
"mailto:odinho@opera.com" title=
"Odin Hørthe Omdal">
4 <meta rel=help
href=
"http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBCursor-continue-void-any-key">
5 <meta rel=assert
title=
"Otherwise this method runs the steps for asynchronously executing a request. However, the steps are slightly modified such that instead of creating a new IDBRequest, it reuses the request originally created when this cursor was created. The done flag on the request is set to false before the request is returned. The steps are run with the cursor's source as source and the steps for iterating a cursor as operation, using this cursor as cursor and the key parameter as key.">
6 <script src=
"/resources/testharness.js"></script>
7 <script src=
"/resources/testharnessreport.js"></script>
8 <script src=
"resources/support.js"></script>
13 var open_rq
= createdb(async_test())
15 open_rq
.onupgradeneeded = function(e
) {
17 var os
= db
.createObjectStore("test")
23 open_rq
.onsuccess = function(e
) {
26 var rq
= db
.transaction("test", "readonly", {durability
: 'relaxed'}).objectStore("test").openCursor()
28 rq
.onsuccess
= this.step_func(function(e
)
33 cursor
= e
.target
.result
35 assert_equals(cursor
.value
, "data", "prequisite cursor.value")
36 cursor
.custom_cursor_value
= 1
37 e
.target
.custom_request_value
= 2
43 assert_equals(cursor
.value
, "data2", "prequisite cursor.value")
44 assert_equals(cursor
.custom_cursor_value
, 1, "custom cursor value")
45 assert_equals(e
.target
.custom_request_value
, 2, "custom request value")
51 assert_false(!!e
.target
.result
, "got cursor")
52 assert_equals(cursor
.custom_cursor_value
, 1, "custom cursor value")
53 assert_equals(e
.target
.custom_request_value
, 2, "custom request value")
59 rq
.transaction
.oncomplete
= this.step_func(function() {
60 assert_equals(count
, 3, "cursor callback runs")
61 assert_equals(rq
.custom_request_value
, 2, "variable placed on old IDBRequest")
62 assert_equals(cursor
.custom_cursor_value
, 1, "custom cursor value (transaction.complete)")