From a183eacb63d2a314854740eb6056bf884c2e97e9 Mon Sep 17 00:00:00 2001 From: KALPESH KRISHNA Date: Fri, 16 Oct 2015 02:37:27 +0530 Subject: [PATCH 1/2] Adding window.onstorage EventHandler --- components/script/dom/htmlbodyelement.rs | 12 ++++++++++++ components/script/dom/webidls/EventHandler.webidl | 1 + components/script/dom/window.rs | 3 +++ 3 files changed, 16 insertions(+) diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 806086a6b03..438aa79ec74 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -83,6 +83,18 @@ impl HTMLBodyElementMethods for HTMLBodyElement { let win = window_from_node(self); win.r().SetOnunload(listener) } + + // https://html.spec.whatwg.org/multipage/#the-body-element + fn GetOnstorage(&self) -> Option> { + let win = window_from_node(self); + win.r().GetOnstorage() + } + + // https://html.spec.whatwg.org/multipage/#the-body-element + fn SetOnstorage(&self, listener: Option>) { + let win = window_from_node(self); + win.r().SetOnstorage(listener) + } } diff --git a/components/script/dom/webidls/EventHandler.webidl b/components/script/dom/webidls/EventHandler.webidl index 8848c3aafbb..7ff237f2ceb 100644 --- a/components/script/dom/webidls/EventHandler.webidl +++ b/components/script/dom/webidls/EventHandler.webidl @@ -36,6 +36,7 @@ interface GlobalEventHandlers { [NoInterfaceObject] interface WindowEventHandlers { attribute EventHandler onunload; + attribute EventHandler onstorage; }; // The spec has |attribute OnErrorEventHandler onerror;| on diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 4ada66c36cc..7172177af77 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -513,6 +513,9 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#handler-window-onunload event_handler!(unload, GetOnunload, SetOnunload); + // https://html.spec.whatwg.org/multipage/#handler-window-onstorage + event_handler!(storage, GetOnstorage, SetOnstorage); + // https://html.spec.whatwg.org/multipage/#handler-onerror error_event_handler!(error, GetOnerror, SetOnerror); From 31f275eb4b50d046fb320744ff34f533ce4e7b90 Mon Sep 17 00:00:00 2001 From: KALPESH KRISHNA Date: Sat, 17 Oct 2015 01:25:12 +0530 Subject: [PATCH 2/2] Removing lines from interfaces.html.ini --- tests/wpt/metadata/html/dom/interfaces.html.ini | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/wpt/metadata/html/dom/interfaces.html.ini b/tests/wpt/metadata/html/dom/interfaces.html.ini index 4f62c39b96a..cc99eb9c7a6 100644 --- a/tests/wpt/metadata/html/dom/interfaces.html.ini +++ b/tests/wpt/metadata/html/dom/interfaces.html.ini @@ -2244,9 +2244,6 @@ [HTMLBodyElement interface: attribute onpopstate] expected: FAIL - [HTMLBodyElement interface: attribute onstorage] - expected: FAIL - [HTMLBodyElement interface: document.createElement("body") must inherit property "link" with the proper type (1)] expected: FAIL @@ -2292,9 +2289,6 @@ [HTMLBodyElement interface: document.createElement("body") must inherit property "onpopstate" with the proper type (16)] expected: FAIL - [HTMLBodyElement interface: document.createElement("body") must inherit property "onstorage" with the proper type (17)] - expected: FAIL - [HTMLHeadingElement interface: existence and properties of interface object] expected: FAIL