<html>
<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function log(a)
{
    document.getElementById("logger").innerHTML += a + "<br>";
}

function finish()
{
    if (window.testRunner)
        testRunner.notifyDone()
}

function runTest()
{
    if (!window.localStorage) {
        log("window.localStorage DOES NOT exist");
        finish();
        return;
    }
    localStorage.clear();
    
    log("Setting FOO using the index setter.");
    localStorage["FOO"] = "BAR";
    log("Reading FOO:");
    log(localStorage.FOO);
    log(localStorage["FOO"]);
    log(localStorage.getItem("FOO"));
    log("");
    
    log("Setting FOO again, using setItem.");
    localStorage.setItem("FOO", "BAZ");
    log("Reading FOO:");
    log(localStorage.FOO);
    log(localStorage["FOO"]);
    log(localStorage.getItem("FOO"));
    log("");

    log("Setting FOO again, using the index setter.");
    localStorage["FOO"] = "BAT";
    log("Reading FOO:");
    log(localStorage.FOO);
    log(localStorage["FOO"]);
    log(localStorage.getItem("FOO"));
    log("");
    
    log("Setting FOO again, using property-slot syntax");
    localStorage.FOO = "BATMAN";
    log("Reading FOO:");
    log(localStorage.FOO);
    log(localStorage["FOO"]);
    log(localStorage.getItem("FOO"));
    log("");
    
    log("Removing FOO, then trying to read it");
    localStorage.removeItem("FOO");
    log("Reading FOO:");
    log(localStorage.FOO);
    log(localStorage["FOO"]);
    log(localStorage.getItem("FOO"));
    log("");
    
    finish();
}

</script>
</head>
<body onload="runTest();">
This is a test to make sure you can get and set values in localStorage by index.<br>
<div id="logger"></div>
</body>
</html>
