summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/domstorage/sessionstorage/string-conversion.html')
-rw-r--r--LayoutTests/storage/domstorage/sessionstorage/string-conversion.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html b/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html
new file mode 100644
index 0000000..64a4e14
--- /dev/null
+++ b/LayoutTests/storage/domstorage/sessionstorage/string-conversion.html
@@ -0,0 +1,54 @@
+<html>
+<head>
+<script src="resources/clearSessionStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.sessionStorage) {
+ log("window.sessionStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + sessionStorage.length);
+
+ log("Testing implicit setters");
+ sessionStorage.a = null;
+ log("Type/value for null is " + typeof sessionStorage.a + "/" + sessionStorage.a);
+ sessionStorage.b = 0;
+ log("Type/value for 0 is " + typeof sessionStorage.b + "/" + sessionStorage.b);
+ sessionStorage.c = function(){};
+ log("Type/value for function(){} is " + typeof sessionStorage.c + "/" + sessionStorage.c);
+
+ log("Testing explicit setters");
+ sessionStorage.setItem('d', null);
+ log("Type/value for null is " + typeof sessionStorage.d + "/" + sessionStorage.d);
+ sessionStorage.setItem('e', 0);
+ log("Type/value for 0 is " + typeof sessionStorage.e + "/" + sessionStorage.e);
+ sessionStorage.setItem('f', function(){});
+ log("Type/value for function(){} is " + typeof sessionStorage.f + "/" + sessionStorage.f);
+
+ log("Testing index setters");
+ sessionStorage['g'] = null;
+ log("Type/value for null is " + typeof sessionStorage.g + "/" + sessionStorage.g);
+ sessionStorage['h'] = 0;
+ log("Type/value for 0 is " + typeof sessionStorage.h + "/" + sessionStorage.h);
+ sessionStorage['i'] = function(){};
+ log("Type/value for function(){} is " + typeof sessionStorage.i + "/" + sessionStorage.i);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test case verifies that session storage only stores strings.
+<div id="logger"></div>
+</body>
+</html>