<!DOCTYPE html>
<title>IndexedDB: Reading cursor value after advancing past range</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/testharness-helpers.js"></script>
<script>
// A regression test for http://crbug.com/487711
indexeddb_test(
function(t, db) {
var store = db.createObjectStore('store');
for (var i = 0; i < 10; ++i)
store.put(i, i);
},
function(t, db) {
var transaction = db.transaction('store', 'readonly', {durability: 'relaxed'});
var store = transaction.objectStore('store');
var req = store.openCursor();
var last_cursor;
req.onsuccess = t.step_func(function(evt) {
var cursor = evt.target.result;
if (cursor) {
last_cursor = cursor;
cursor.continue();
} else {
assert_equals(last_cursor.value, undefined);
t.done();
}
});
req.onerror = t.step_func(function() {
assert_unreached('open should not fail');
});
},
'Access to cursor value after final advance should be undefined'
);
</script>