chromium/third_party/blink/web_tests/storage/domstorage/sessionstorage/index-get-and-set.html

<html>
<head>
<script src="resources/clearSessionStorage.js"></script>
<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.sessionStorage) {
        log("window.sessionStorage DOES NOT exist");
        finish();
        return;
    }
    
    log("Setting FOO using the index setter.");
    sessionStorage["FOO"] = "BAR";
    log("Reading FOO:");
    log(sessionStorage.FOO);
    log(sessionStorage["FOO"]);
    log(sessionStorage.getItem("FOO"));
    log("");
    
    log("Setting FOO again, using setItem.");
    sessionStorage.setItem("FOO", "BAZ");
    log("Reading FOO:");
    log(sessionStorage.FOO);
    log(sessionStorage["FOO"]);
    log(sessionStorage.getItem("FOO"));
    log("");

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

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