<html>
<head>
<script src="resources/clearSessionStorage.js"></script>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(a)
{
document.getElementById("logger").innerHTML += a + "<br>";
}
function runTest()
{
if (!window.sessionStorage) {
log("window.sessionStorage DOES NOT exist");
return;
}
log("Length is " + sessionStorage.length);
log("Testing implicit setters");
sessionStorage.a = null;
log("Type/value for null is " + typeof sessionStorage.a + "/" + sessionStorage.a);
sessionStorage.b = 0;
log("Type/value for 0 is " + typeof sessionStorage.b + "/" + sessionStorage.b);
sessionStorage.c = function(){};
log("Type/value for function(){} is " + typeof sessionStorage.c + "/" + sessionStorage.c);
log("Testing explicit setters");
sessionStorage.setItem('d', null);
log("Type/value for null is " + typeof sessionStorage.d + "/" + sessionStorage.d);
sessionStorage.setItem('e', 0);
log("Type/value for 0 is " + typeof sessionStorage.e + "/" + sessionStorage.e);
sessionStorage.setItem('f', function(){});
log("Type/value for function(){} is " + typeof sessionStorage.f + "/" + sessionStorage.f);
log("Testing index setters");
sessionStorage['g'] = null;
log("Type/value for null is " + typeof sessionStorage.g + "/" + sessionStorage.g);
sessionStorage['h'] = 0;
log("Type/value for 0 is " + typeof sessionStorage.h + "/" + sessionStorage.h);
sessionStorage['i'] = function(){};
log("Type/value for function(){} is " + typeof sessionStorage.i + "/" + sessionStorage.i);
}
</script>
</head>
<body onload="runTest();">
This test case verifies that session storage only stores strings.
<div id="logger"></div>
</body>
</html>