aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortigercosmos <phy.tiger@gmail.com>2019-05-17 00:17:14 +0800
committertigercosmos <phy.tiger@gmail.com>2019-05-19 03:23:42 +0800
commite80fdede4c065c276b1083931c25c4a9f0bb3320 (patch)
tree0da9ac77ea7913affb5e4c370858199961564132
parent576394b288270e49562898cca497959eb9b5a711 (diff)
downloadservo-e80fdede4c065c276b1083931c25c4a9f0bb3320.tar.gz
servo-e80fdede4c065c276b1083931c25c4a9f0bb3320.zip
window.name deals with lack of browsing context
-rw-r--r--components/script/dom/window.rs9
-rw-r--r--tests/wpt/metadata/html/browsers/the-window-object/name-attribute.window.js.ini4
2 files changed, 7 insertions, 6 deletions
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
-