blob: 7583f6ed44089bcae1d1ceb022895084d84baa60 [file] [log] [blame]
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function log(a)
{
document.getElementById("logger").innerHTML += a + "<br>";
}
function startTest()
{
if (!window.localStorage) {
log("window.localStorage DOES NOT exist");
return;
}
localStorage.clear();
Storage.prototype.prototypeTestKey = "prototypeTestValue";
localStorage.foo = "bar";
localStorage.fu = "baz";
localStorage.batman = "bin suparman";
localStorage.bar = "foo";
localStorage.alpha = "beta";
localStorage.zeta = "gamma";
// Enumerate localStorage, appending each key onto an array
var enumeratedArray = new Array();
for (var n in localStorage)
enumeratedArray.push(n);
// Sort the array, since the storage order isn't guaranteed
enumeratedArray.sort();
for (var n in enumeratedArray)
log(enumeratedArray[n]);
}
</script>
</head>
<body onload="startTest();">
This test checks to see that you can enumerate a Storage object and get only the keys as a result. The built-in properties of the Storage object should be ignored. The test operates on the localStorage object.<br>
<div id="logger"></div>
</body>
</html>