Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / domstorage / sessionstorage / enumerate-with-length-and-key.html
blob75e6e518adf740ab61d649a4a11eb94d4a5172d6
1 <html>
2 <head>
3 <script src="resources/clearSessionStorage.js"></script>
4 <script>
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 function log(a)
11 document.getElementById("logger").innerHTML += a + "<br>";
14 function startTest()
16 if (!window.sessionStorage) {
17 log("window.sessionStorage DOES NOT exist");
18 return;
21 Storage.prototype.prototypeTestKey = "prototypeTestValue";
22 sessionStorage.foo = "bar";
23 sessionStorage.fu = "baz";
24 sessionStorage.batman = "bin suparman";
25 sessionStorage.bar = "foo";
26 sessionStorage.alpha = "beta";
27 sessionStorage.zeta = "gamma";
29 // Enumerate sessionStorage, appending each key onto an array
30 var enumeratedArray = new Array();
31 for (var n in sessionStorage)
32 enumeratedArray.push(n);
34 // Sort the array, since the storage order isn't guaranteed
35 enumeratedArray.sort();
37 for (var n in enumeratedArray)
38 log(enumeratedArray[n]);
41 </script>
42 </head>
43 <body onload="startTest();">
44 This test attempts to enumerate all the keys in sessionStorage with .length + .key(). The built-in properties of the Storage object should be ignored. The test operates on the sessionStorage object.<br>
45 <div id="logger"></div>
46 </body>
47 </html>