<html>
<head>
<script>

if (window.testRunner)
    testRunner.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");
    if ("clear" in storage)
        log("Storage object " + name + " has clear");
}

function runTest()
{
    if ("sessionStorage" in window) {
        log("window.sessionStorage exists");
        testStorage("sessionStorage", window.sessionStorage);
        log("window.sessionStorage == window.sessionStorage: " + (window.sessionStorage == window.sessionStorage));
        log("window.sessionStorage === window.sessionStorage: " + (window.sessionStorage === window.sessionStorage));
    } else
        log("window.sessionStorage DOES NOT exist");

    if ("localStorage" in window) {
        log("window.localStorage exists");
        testStorage("localStorage", window.localStorage);
        log("window.localStorage == window.localStorage: " + (window.localStorage == window.localStorage));
        log("window.localStorage === window.localStorage: " + (window.localStorage === window.localStorage));
    } else
        log("window.localStorage DOES NOT exist");

    if ("onstorage" in window)
        log("window.onstorage exists");
    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>
