summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/localstorage/string-conversion.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/domstorage/localstorage/string-conversion.html')
-rw-r--r--LayoutTests/storage/domstorage/localstorage/string-conversion.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/LayoutTests/storage/domstorage/localstorage/string-conversion.html b/LayoutTests/storage/domstorage/localstorage/string-conversion.html
new file mode 100644
index 0000000..aa8bdfd
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/string-conversion.html
@@ -0,0 +1,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>