Revision 9e8a2af4be1ef619f350af1c73b63922d13a94b7 authored by Michael[tm] Smith on 09 April 2014, 14:23:12 UTC, committed by Michael[tm] Smith on 09 April 2014, 14:23:12 UTC
1 parent a4b8200
idbcursor_continue_objectstore3.htm
<!DOCTYPE html>
<html>
<head>
<title>IDBCursor.continue() - object store - attempt to iterate to the previous record when the direction is set for the next record</title>
<script type="text/javascript" src="support.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="text/javascript">
var objectStoreName = "objectstore";
var records = [ { pKey: "primaryKey_0" },
{ pKey: "primaryKey_1" }];
var count = records.length;
var db = null;
var t = async_test();
function RunTest() {
var rqOpen = window.indexedDB.open(databaseName, databaseVersion);
rqOpen.onupgradeneeded = t.step_func( function (event) {
db = event.target.result;
db.onerror = t.step_func( assert_database_error );
var objStore = db.createObjectStore(objectStoreName, {keyPath:"pKey"});
for(var i = 0; i < records.length; i++) {
objStore.add(records[i]);
}
});
rqOpen.onsuccess = t.step_func( VerifyCursorThrowsException );
rqOpen.onerror = t.step_func( assert_open_request_error );
}
function VerifyCursorThrowsException(event) {
var txn = db.transaction(objectStoreName, "readonly");
var objStore = txn.objectStore(objectStoreName);
var rqCursor = objStore.openCursor();
rqCursor.onsuccess = t.step_func( function(event) {
var cursor = event.target.result;
assert_cursor_exists(cursor);
try {
cursor.continue(records[0].pKey);
} catch(ex) {
assert_equals(ex.name, "DataError", "ex.name");
t.done();
return;
}
assert_expected_exception();
});
}
add_completion_callback(function() { if(db) db.close(); });
setup(function() {
var rqDelete = window.indexedDB.deleteDatabase(databaseName);
rqDelete.onsuccess = t.step_func( RunTest );
});
</script>
</head>
<body>
<div id="log">
</div>
</body>
</html>
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...