summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/events/resources
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/domstorage/events/resources')
-rw-r--r--LayoutTests/storage/domstorage/events/resources/body-event-handler.html8
-rw-r--r--LayoutTests/storage/domstorage/events/resources/eventTestHarness.js51
-rw-r--r--LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html11
3 files changed, 70 insertions, 0 deletions
diff --git a/LayoutTests/storage/domstorage/events/resources/body-event-handler.html b/LayoutTests/storage/domstorage/events/resources/body-event-handler.html
new file mode 100644
index 0000000..a1218fe
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/body-event-handler.html
@@ -0,0 +1,8 @@
+<html><head><script>
+
+function handleStorageEvent(e) {
+ window.parent.storageEventList.push(e);
+}
+
+</script></head><body onstorage="handleStorageEvent(window.event);">
+</body></html>
diff --git a/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js b/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js
new file mode 100644
index 0000000..8f15c31
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/eventTestHarness.js
@@ -0,0 +1,51 @@
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+iframe = document.createElement("IFRAME");
+iframe.src = "about:blank";
+document.body.appendChild(iframe);
+iframe.contentWindow.document.body.innerText = "Nothing to see here.";
+
+storageEventList = new Array();
+iframe.contentWindow.onstorage = function (e) {
+ window.parent.storageEventList.push(e);
+}
+
+function runAfterStorageEvents(callback) {
+ var currentCount = storageEventList.length;
+ function onTimeout() {
+ if (currentCount != storageEventList.length)
+ runAfterStorageEvents(callback);
+ else
+ callback();
+ }
+ setTimeout(onTimeout, 0);
+}
+
+function testStorages(testCallback)
+{
+ // When we're done testing LocalStorage, this is run.
+ function allDone()
+ {
+ debug("");
+ debug("");
+ window.successfullyParsed = true;
+ isSuccessfullyParsed();
+ debug("");
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+ }
+
+ // When we're done testing with SessionStorage, this is run.
+ function runLocalStorage()
+ {
+ debug("");
+ debug("");
+ testCallback("localStorage", allDone);
+ }
+
+ // First run the test with SessionStorage.
+ testCallback("sessionStorage", runLocalStorage);
+}
diff --git a/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html b/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html
new file mode 100644
index 0000000..a764c53
--- /dev/null
+++ b/LayoutTests/storage/domstorage/events/resources/setattribute-event-handler.html
@@ -0,0 +1,11 @@
+<html><head></head><body>
+<script>
+
+function handleStorageEvent(e) {
+ window.parent.storageEventList.push(e);
+}
+
+document.body.setAttribute("onstorage", "handleStorageEvent(window.event);");
+
+</script>
+</body></html>