Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / domstorage / sessionstorage / index-get-and-set.html
bloba98dee893b6f1c7558991a384632ecb7761d3f8c
1 <html>
2 <head>
3 <script src="resources/clearSessionStorage.js"></script>
4 <script>
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
11 function log(a)
13 document.getElementById("logger").innerHTML += a + "<br>";
16 function finish()
18 if (window.testRunner)
19 testRunner.notifyDone()
22 function runTest()
24 if (!window.sessionStorage) {
25 log("window.sessionStorage DOES NOT exist");
26 finish();
27 return;
30 log("Setting FOO using the index setter.");
31 sessionStorage["FOO"] = "BAR";
32 log("Reading FOO:");
33 log(sessionStorage.FOO);
34 log(sessionStorage["FOO"]);
35 log(sessionStorage.getItem("FOO"));
36 log("");
38 log("Setting FOO again, using setItem.");
39 sessionStorage.setItem("FOO", "BAZ");
40 log("Reading FOO:");
41 log(sessionStorage.FOO);
42 log(sessionStorage["FOO"]);
43 log(sessionStorage.getItem("FOO"));
44 log("");
46 log("Setting FOO again, using the index setter.");
47 sessionStorage["FOO"] = "BAT";
48 log("Reading FOO:");
49 log(sessionStorage.FOO);
50 log(sessionStorage["FOO"]);
51 log(sessionStorage.getItem("FOO"));
52 log("");
54 log("Setting FOO again, using property-slot syntax");
55 sessionStorage.FOO = "BATMAN";
56 log("Reading FOO:");
57 log(sessionStorage.FOO);
58 log(sessionStorage["FOO"]);
59 log(sessionStorage.getItem("FOO"));
60 log("");
62 log("Removing FOO, then trying to read it");
63 sessionStorage.removeItem("FOO");
64 log("Reading FOO:");
65 log(sessionStorage.FOO);
66 log(sessionStorage["FOO"]);
67 log(sessionStorage.getItem("FOO"));
68 log("");
70 finish();
73 </script>
74 </head>
75 <body onload="runTest();">
76 This is a test to make sure you can get and set values in SessionStorage by index.<br>
77 <div id="logger"></div>
78 </body>
79 </html>