OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>IndexedDB: IDBCursor continuePrimaryKey() method</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 |
| 7 async_test(function(t) { |
| 8 var dbname = document.location + '-' + t.name; |
| 9 var del = indexedDB.deleteDatabase(dbname); |
| 10 del.onerror = t.unreached_func('deleteDatabase should succeed'); |
| 11 var open = indexedDB.open(dbname); |
| 12 open.onerror = t.unreached_func('open should succeed'); |
| 13 |
| 14 open.onupgradeneeded = t.step_func(function() { |
| 15 var db = open.result; |
| 16 var store = db.createObjectStore('store'); |
| 17 store.put('a', 1).onerror = t.unreached_func('put should not fail'); |
| 18 var request = store.openCursor(); |
| 19 request.onerror = t.unreached_func('openCursor should not fail'); |
| 20 request.onsuccess = function() { |
| 21 var cursor = request.result; |
| 22 assert_class_string(cursor, 'IDBCursorWithValue', |
| 23 'result should be a cursor'); |
| 24 |
| 25 assert_throws('InvalidAccessError', function() { |
| 26 cursor.continuePrimaryKey(2, 2); |
| 27 }, 'continuePrimaryKey() should throw if source is not an index'); |
| 28 }; |
| 29 }); |
| 30 |
| 31 open.onsuccess = t.step_func(function() { |
| 32 var db = open.result; |
| 33 db.close(); |
| 34 t.done(); |
| 35 }); |
| 36 |
| 37 }, 'IDBCursor continuePrimaryKey() on object store cursor'); |
| 38 |
| 39 </script> |
OLD | NEW |