| OLD | NEW | 
| (Empty) |  | 
 |   1 <!DOCTYPE html> | 
 |   2 <title>IDBCursor.continue() - index - attempt to iterate to the previous record 
    when the direction is set for the next record </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="The parameter is less than or equal to this cursor's pos
    ition and this cursor's direction is 'next' or 'nextunique'."> | 
 |   6 <script src="../../../resources/testharness.js"></script> | 
 |   7 <script src="../../../resources/testharnessreport.js"></script> | 
 |   8 <script src="support.js"></script> | 
 |   9  | 
 |  10 <script> | 
 |  11  | 
 |  12     var db, | 
 |  13       t = async_test(), | 
 |  14       records = [ { pKey: "primaryKey_0", iKey: "indexKey_0" }, | 
 |  15                   { pKey: "primaryKey_1", iKey: "indexKey_1" } ]; | 
 |  16  | 
 |  17     var open_rq = createdb(t); | 
 |  18     open_rq.onupgradeneeded = function(e) { | 
 |  19         db = e.target.result; | 
 |  20         var objStore = db.createObjectStore("test", {keyPath:"pKey"}); | 
 |  21  | 
 |  22         objStore.createIndex("index", "iKey"); | 
 |  23  | 
 |  24         for (var i = 0; i < records.length; i++) | 
 |  25             objStore.add(records[i]); | 
 |  26     }; | 
 |  27  | 
 |  28     open_rq.onsuccess = function(e) { | 
 |  29         var count = 0; | 
 |  30         var cursor_rq = db.transaction("test") | 
 |  31                           .objectStore("test") | 
 |  32                           .index("index") | 
 |  33                           .openCursor(undefined, "next"); // XXX: Fx has issue w
    ith "undefined" | 
 |  34  | 
 |  35         cursor_rq.onsuccess = t.step_func(function(e) { | 
 |  36             var cursor = e.target.result; | 
 |  37             if (!cursor) { | 
 |  38                 assert_equals(count, 2, "ran number of times"); | 
 |  39                 t.done(); | 
 |  40             } | 
 |  41  | 
 |  42             // First time checks key equal, second time checks key less than | 
 |  43             assert_throws("DataError", | 
 |  44                 function() { cursor.continue(records[0].iKey); }); | 
 |  45  | 
 |  46             cursor.continue(); | 
 |  47  | 
 |  48             count++; | 
 |  49         }); | 
 |  50     }; | 
 |  51  | 
 |  52 </script> | 
 |  53  | 
 |  54 <div id="log"></div> | 
| OLD | NEW |