Implement window.closed

This commit is contained in:
antunovicm 2017-05-18 09:17:03 +12:00 committed by Mate Antunovic
parent 161dc666b0
commit 510bea7a7a
6 changed files with 10 additions and 11 deletions

View file

@ -23,7 +23,7 @@
//[Replaceable] readonly attribute BarProp toolbar;
attribute DOMString status;
void close();
//readonly attribute boolean closed;
readonly attribute boolean closed;
//void stop();
//void focus();
//void blur();

View file

@ -505,6 +505,13 @@ impl WindowMethods for Window {
}
}
// https://html.spec.whatwg.org/multipage/#dom-window-closed
fn Closed(&self) -> bool {
self.window_proxy.get()
.map(|ref proxy| proxy.is_browsing_context_discarded())
.unwrap_or(true)
}
// https://html.spec.whatwg.org/multipage/#dom-window-close
fn Close(&self) {
self.main_thread_script_chan()