window.name deals with lack of browsing context

This commit is contained in:
tigercosmos 2019-05-17 00:17:14 +08:00
parent 576394b288
commit e80fdede4c
2 changed files with 7 additions and 6 deletions

View file

@ -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