blob: aa8bdfd4e36182dc4d7e9b04a60e337d1f4e34dc (
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
52
53
54
|
<html>
<head>
<script src="resources/clearLocalStorage.js"></script>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function log(a)
{
document.getElementById("logger").innerHTML += a + "<br>";
}
function runTest()
{
if (!window.localStorage) {
log("window.localStorage DOES NOT exist");
return;
}
log("Length is " + localStorage.length);
log("Testing implicit setters");
localStorage.a = null;
log("Type/value for null is " + typeof localStorage.a + "/" + localStorage.a);
localStorage.b = 0;
log("Type/value for 0 is " + typeof localStorage.b + "/" + localStorage.b);
localStorage.c = function(){};
log("Type/value for function(){} is " + typeof localStorage.c + "/" + localStorage.c);
log("Testing explicit setters");
localStorage.setItem('d', null);
log("Type/value for null is " + typeof localStorage.d + "/" + localStorage.d);
localStorage.setItem('e', 0);
log("Type/value for 0 is " + typeof localStorage.e + "/" + localStorage.e);
localStorage.setItem('f', function(){});
log("Type/value for function(){} is " + typeof localStorage.f + "/" + localStorage.f);
log("Testing index setters");
localStorage['g'] = null;
log("Type/value for null is " + typeof localStorage.g + "/" + localStorage.g);
localStorage['h'] = 0;
log("Type/value for 0 is " + typeof localStorage.h + "/" + localStorage.h);
localStorage['i'] = function(){};
log("Type/value for function(){} is " + typeof localStorage.i + "/" + localStorage.i);
}
</script>
</head>
<body onload="runTest();">
This test case verifies that local storage only stores strings.
<div id="logger"></div>
</body>
</html>
|