OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IDBCursor.continue() - index - attempt to pass a key parameter that is no
t a valid key</title> |
| 3 <link rel="author" title="Microsoft" href="http://www.microsoft.com"> |
| 4 <link rel=help href="http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#
widl-IDBCursor-continue-void-any-key"> |
| 5 <link rel=assert title="If the key parameter is specified and fulfills any of th
ese conditions this method must throw a DOMException of type DataError"> |
| 6 <link rel=assert title="The parameter is not a valid key."> |
| 7 <script src="../../../resources/testharness.js"></script> |
| 8 <script src="../../../resources/testharnessreport.js"></script> |
| 9 <script src="support.js"></script> |
| 10 |
| 11 <script> |
| 12 |
| 13 var db, |
| 14 t = async_test(), |
| 15 records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" }, |
| 16 { pKey: "primaryKey_1", iKey: "indexKey_1" } ]; |
| 17 |
| 18 var open_rq = createdb(t); |
| 19 open_rq.onupgradeneeded = function(e) { |
| 20 db = e.target.result; |
| 21 var objStore = db.createObjectStore("test", {keyPath:"pKey"}); |
| 22 |
| 23 objStore.createIndex("index", "iKey"); |
| 24 |
| 25 for(var i = 0; i < records.length; i++) |
| 26 objStore.add(records[i]); |
| 27 }; |
| 28 |
| 29 open_rq.onsuccess = function(e) { |
| 30 var cursor_rq = db.transaction("test") |
| 31 .objectStore("test") |
| 32 .index("index") |
| 33 .openCursor(); |
| 34 |
| 35 cursor_rq.onsuccess = t.step_func(function(e) { |
| 36 var cursor = e.target.result; |
| 37 |
| 38 assert_throws("DataError", |
| 39 function() { cursor.continue(document); }); |
| 40 |
| 41 assert_true(cursor instanceof IDBCursorWithValue, "cursor"); |
| 42 |
| 43 t.done(); |
| 44 }); |
| 45 }; |
| 46 |
| 47 </script> |
| 48 |
| 49 <div id="log"></div> |
OLD | NEW |