blob: 2d6b49332e7a221e1798781b39ff8d975460f270 [file] [log] [blame]
<html>
<head>
<script>
if (layoutTestController)
layoutTestController.dumpAsText();
function log(a)
{
document.getElementById("logger").innerHTML += a + "<br>";
}
function testStorage(name, storage)
{
if ("length" in storage)
log("Storage object " + name + " has length");
if ("key" in storage)
log("Storage object " + name + " has key");
if ("getItem" in storage)
log("Storage object " + name + " has getItem");
if ("setItem" in storage)
log("Storage object " + name + " has setItem");
if ("removeItem" in storage)
log("Storage object " + name + " has removeItem");
}
function testOnstorage()
{
window.onstorage = function(event)
{
log("The onstorage property works when a storage event is fired.");
}
window.localStorage["test"] = "test";
}
function runTest()
{
if ("sessionStorage" in window) {
log("window.sessionStorage exists");
testStorage("sessionStorage", window.sessionStorage);
} else
log("window.sessionStorage DOES NOT exist");
if ("localStorage" in window) {
log("window.localStorage exists");
testStorage("localStorage", window.localStorage);
} else
log("window.localStorage DOES NOT exist");
if ("onstorage" in window) {
log("window.onstorage exists");
testOnstorage();
} else
log("window.onstorage DOES NOT exist");
}
</script>
</head>
<body onload="runTest();">
This test checks to see if window.localStorage, window.sessionStorage and window.onstorage exist.<br>
<div id="logger"></div>
</body>
</html>