From e80fdede4c065c276b1083931c25c4a9f0bb3320 Mon Sep 17 00:00:00 2001 From: tigercosmos Date: Fri, 17 May 2019 00:17:14 +0800 Subject: [PATCH] window.name deals with lack of browsing context --- components/script/dom/window.rs | 9 +++++++-- .../the-window-object/name-attribute.window.js.ini | 4 ---- 2 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 tests/wpt/metadata/html/browsers/the-window-object/name-attribute.window.js.ini diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 1a8b5e68c8b..64a01a57baa 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -1160,12 +1160,17 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-name fn SetName(&self, name: DOMString) { - self.window_proxy().set_name(name); + if let Some(proxy) = self.undiscarded_window_proxy() { + proxy.set_name(name); + } } // https://html.spec.whatwg.org/multipage/#dom-name fn Name(&self) -> DOMString { - self.window_proxy().get_name() + match self.undiscarded_window_proxy() { + Some(proxy) => proxy.get_name(), + None => "".into(), + } } // https://html.spec.whatwg.org/multipage/#dom-origin diff --git a/tests/wpt/metadata/html/browsers/the-window-object/name-attribute.window.js.ini b/tests/wpt/metadata/html/browsers/the-window-object/name-attribute.window.js.ini deleted file mode 100644 index 015d05d87e1..00000000000 --- a/tests/wpt/metadata/html/browsers/the-window-object/name-attribute.window.js.ini +++ /dev/null @@ -1,4 +0,0 @@ -[name-attribute.window.html] - [Window object's name IDL attribute] - expected: FAIL -