blob: 0eb43fbd53dd98ee4aa7aa1bbefa49737d29dd16 [file] [log] [blame]
<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);
}
</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>