dd3932903588edfdab9ab7eb92a4dd54c2ed5e42
[gecko.git] / idbcursor_update_index6.htm
blobdd3932903588edfdab9ab7eb92a4dd54c2ed5e42
1 <!DOCTYPE html>
2 <title>IDBCursor.update() - index - no argument</title>
3 <link rel="author" title="Intel" href="http://www.intel.com">
4 <link rel="help" href="https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#widl-IDBCursor-update-IDBRequest-any-value">
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="resources/support.js"></script>
8 <div id="log"></div>
9 <script>
10 var db,
11 t = async_test(),
12 records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" },
13 { pKey: "primaryKey_1", iKey: "indexKey_1" } ];
15 var open_rq = createdb(t);
16 open_rq.onupgradeneeded = function(e) {
17 db = e.target.result;
19 var objStore = db.createObjectStore("test", { keyPath: "pKey" });
20 objStore.createIndex("index", "iKey");
22 for (var i = 0; i < records.length; i++)
23 objStore.add(records[i]);
26 open_rq.onsuccess = function(e) {
27 var cursor_rq = db.transaction("test", "readonly", {durability: 'relaxed'})
28 .objectStore("test")
29 .index("index")
30 .openCursor();
32 cursor_rq.onsuccess = t.step_func(function(e) {
33 var cursor = e.target.result;
34 assert_true(cursor instanceof IDBCursor);
36 assert_throws_js(TypeError, function() { cursor.update(); });
37 t.done();
38 });
40 </script>