chromium/third_party/blink/web_tests/storage/indexeddb/cursor-cast.html

<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script src="resources/shared.js"></script>
<script>

description("Ensure cursor wrappers are created correctly.");

indexedDBTest(prepareDatabase, verifyWrappers);
function prepareDatabase(evt)
{
    preamble(evt);
    evalAndLog("db = event.target.result");
    evalAndLog("store = db.createObjectStore('store')");
    evalAndLog("store.put(0, 0)");
}

function verifyWrappers(evt)
{
    preamble(evt);
    evalAndLog("db = event.target.result");
    evalAndLog("tx = db.transaction('store', 'readwrite', {durability: 'relaxed'})");
    evalAndLog("request = tx.objectStore('store').openCursor()");

    request.onsuccess = function onOpenCursorSuccess(evt) {
        preamble(evt);
        evalAndLog("cursor = event.target.result");
        evalAndLog("request = cursor.update(1)");

        request.onsuccess = function onUpdateSuccess(evt) {
            preamble(evt);
            evalAndLog("cursor = null");
            gc();
            setTimeout(checkCursorType, 0);
        };
    };
}

function checkCursorType() {
    shouldBeEqualToString("request.source.toString()", "[object IDBCursorWithValue]");
    finishJSTest();
}

</script>