chromium/third_party/blink/web_tests/storage/indexeddb/clone-exception.html

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

description("Ensure DataCloneError is consistently thrown by IndexedDB methods");

var NON_CLONEABLE = self;
var INVALID_KEY = {};

setDBNameFromPath();
waitForRequests([
    indexedDB.deleteDatabase(dbname + '1'),
    indexedDB.deleteDatabase(dbname + '2'),
    indexedDB.deleteDatabase(dbname + '3')
], doFirstOpen);

function doFirstOpen()
{
    preamble();
    request = evalAndLog("indexedDB.open(dbname + '1')");
    request.onupgradeneeded = function onUpgradeNeeded(e) {
        preamble();
        db = e.target.result;
        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
        doSecondOpen();
    };
}

function doSecondOpen()
{
    preamble();
    request = evalAndLog("indexedDB.open(dbname + '2')");
    request.onupgradeneeded = function onUpgradeNeeded(e) {
        preamble();
        db = e.target.result;
        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, 0);", "25", "'DataCloneError'");
        doThirdOpen();
    };
}

function doThirdOpen()
{
    preamble();
    request = evalAndLog("indexedDB.open(dbname + '3')");
    request.onupgradeneeded = function onUpgradeNeeded(e) {
        preamble();
        db = e.target.result;
        evalAndExpectException("db.createObjectStore('store').put(NON_CLONEABLE, INVALID_KEY);", "25", "'DataCloneError'");
        finishJSTest();
    };
}

</script>