summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/window-attributes-exist.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/domstorage/window-attributes-exist.html')
-rw-r--r--LayoutTests/storage/domstorage/window-attributes-exist.html59
1 files changed, 59 insertions, 0 deletions
diff --git a/LayoutTests/storage/domstorage/window-attributes-exist.html b/LayoutTests/storage/domstorage/window-attributes-exist.html
new file mode 100644
index 0000000..d01ba7c
--- /dev/null
+++ b/LayoutTests/storage/domstorage/window-attributes-exist.html
@@ -0,0 +1,59 @@
+<html>
+<head>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function testStorage(name, storage)
+{
+ if ("length" in storage)
+ log("Storage object " + name + " has length");
+ if ("key" in storage)
+ log("Storage object " + name + " has key");
+ if ("getItem" in storage)
+ log("Storage object " + name + " has getItem");
+ if ("setItem" in storage)
+ log("Storage object " + name + " has setItem");
+ if ("removeItem" in storage)
+ log("Storage object " + name + " has removeItem");
+ if ("clear" in storage)
+ log("Storage object " + name + " has clear");
+}
+
+function runTest()
+{
+ if ("sessionStorage" in window) {
+ log("window.sessionStorage exists");
+ testStorage("sessionStorage", window.sessionStorage);
+ log("window.sessionStorage == window.sessionStorage: " + (window.sessionStorage == window.sessionStorage));
+ log("window.sessionStorage === window.sessionStorage: " + (window.sessionStorage === window.sessionStorage));
+ } else
+ log("window.sessionStorage DOES NOT exist");
+
+ if ("localStorage" in window) {
+ log("window.localStorage exists");
+ testStorage("localStorage", window.localStorage);
+ log("window.localStorage == window.localStorage: " + (window.localStorage == window.localStorage));
+ log("window.localStorage === window.localStorage: " + (window.localStorage === window.localStorage));
+ } else
+ log("window.localStorage DOES NOT exist");
+
+ if ("onstorage" in window)
+ log("window.onstorage exists");
+ else
+ log("window.onstorage DOES NOT exist");
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test checks to see if window.localStorage, window.sessionStorage and window.onstorage exist.<br>
+<div id="logger"></div>
+</body>
+</html>