summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/sessionstorage/delete-removal.html
blob: 7a4b8d291637435f05fac83209286ef86bc66fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html>
<head>
<script src="resources/clearSessionStorage.js"></script>
<script>

if (window.layoutTestController)
    layoutTestController.dumpAsText();

function log(a)
{
    document.getElementById('logger').appendChild(document.createTextNode(a));
    document.getElementById('logger').appendChild(document.createElement("br"));
}

function runTest()
{
    if (!window.sessionStorage) {
        log("window.sessionStorage DOES NOT exist");
        return;
    }
    
    log("foo (before anything) is: " + sessionStorage.foo);
    sessionStorage.foo = "bar";
    log("foo (after a named property setter set) is: " + sessionStorage.foo);
    delete sessionStorage.foo;
    log("foo (after a delete) is: " + sessionStorage.foo);
    sessionStorage["foo"] = "bar";
    log("foo (after an indexed setter set) is: " + sessionStorage.foo);
    delete sessionStorage.FOO;
    log("foo (after deleting FOO (not foo)) is : " + sessionStorage.foo);
    delete sessionStorage.foo;
    log("foo (after a delete) is: " + sessionStorage.foo);
    sessionStorage.setItem("foo", "bar");
    log("foo (after calling setItem) is: " + sessionStorage.foo);
    delete sessionStorage.foo;
    log("foo (after a delete) is: " + sessionStorage.foo);
    delete sessionStorage.foo;
    log("foo (after a redundant delete) is: " + sessionStorage.foo);
    sessionStorage.foo = "bar";
    log("foo (after a named property setter set) is: " + sessionStorage.foo);
    delete sessionStorage["foo"];
    log("foo (after an indexed delete) is: " + sessionStorage.foo);
}

</script>
</head>
<body onload="runTest();">
This test makes sure that using the syntax `delete sessionStorage.keyName` works as an alias to `sessionStorage.removeItem(keyName).`<br><hr>
<div id="logger"></div>
</body>
</html>