<html>
<head>
<script src="resources/clearSessionStorage.js"></script>
<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.sessionStorage) {
log("window.sessionStorage DOES NOT exist");
return;
}
log("foo (before anything) is: " + sessionStorage.foo);
sessionStorage.foo = "bar";
log("foo (after a named property setter set) is: " + sessionStorage.foo);
delete sessionStorage.foo;
log("foo (after a delete) is: " + sessionStorage.foo);
sessionStorage["foo"] = "bar";
log("foo (after an indexed setter set) is: " + sessionStorage.foo);
delete sessionStorage.FOO;
log("foo (after deleting FOO (not foo)) is : " + sessionStorage.foo);
delete sessionStorage.foo;
log("foo (after a delete) is: " + sessionStorage.foo);
sessionStorage.setItem("foo", "bar");
log("foo (after calling setItem) is: " + sessionStorage.foo);
delete sessionStorage.foo;
log("foo (after a delete) is: " + sessionStorage.foo);
delete sessionStorage.foo;
log("foo (after a redundant delete) is: " + sessionStorage.foo);
sessionStorage.foo = "bar";
log("foo (after a named property setter set) is: " + sessionStorage.foo);
delete sessionStorage["foo"];
log("foo (after an indexed delete) is: " + sessionStorage.foo);
}
</script>
</head>
<body onload="runTest();">
This test makes sure that using the syntax `delete sessionStorage.keyName` works as an alias to `sessionStorage.removeItem(keyName).`<br><hr>
<div id="logger"></div>
</body>
</html>