chromium/third_party/blink/web_tests/storage/domstorage/localstorage/delete-removal.html

<html>
<head>
<script>

if (window.testRunner)
    testRunner.dumpAsText();

function log(a)
{
    document.getElementById('logger').appendChild(document.createTextNode(a));
    document.getElementById('logger').appendChild(document.createElement("br"));
}

function runTest()
{
    if (!window.localStorage) {
        log("window.localStorage DOES NOT exist");
        return;
    }
    localStorage.clear();

    log("foo (before anything) is: " + localStorage.foo);
    localStorage.foo = "bar";
    log("foo (after a named property settter set) is: " + localStorage.foo);
    delete localStorage.foo;
    log("foo (after a delete) is: " + localStorage.foo);
    localStorage["foo"] = "bar";
    log("foo (after an indexed setter set) is: " + localStorage.foo);
    delete localStorage.FOO;
    log("foo (after deleting FOO (not foo)) is: " + localStorage.foo);
    delete localStorage.foo;
    log("foo (after a delete) is: " + localStorage.foo);
    localStorage.setItem("foo", "bar");
    log("foo (after calling setItem) is: " + localStorage.foo);
    delete localStorage.foo;
    log("foo (after a delete) is: " + localStorage.foo);
    delete localStorage.foo;
    log("foo (after a redundant delete) is: " + localStorage.foo);
    localStorage.foo = "bar";
    log("foo (after an implicit settter set) is: " + localStorage.foo);
    delete localStorage["foo"];
    log("foo (after an indexed delete) is: " + localStorage.foo);

    Object.defineProperty(localStorage, "bar", {value: "present", configurable: true});
    log("bar (before an indexed delete) is present: " + ("bar" in localStorage));
    delete localStorage["bar"];
    log("bar (after an indexed delete) is present: " + ("bar" in localStorage));

    Object.defineProperty(localStorage, "1", {value: "present", configurable: true});
    log("Indexed property '1' (before delete) is present: " + (1 in localStorage));
    delete localStorage[1];
    log("Indexed property '1' (after delete) is present: " + (1 in localStorage));
}

</script>
</head>
<body onload="runTest();">
This test makes sure that using the syntax `delete localStorage.keyName` works as an alias to `localStorage.removeItem(keyName).`<br><hr>
<div id="logger"></div>
</body>
</html>