diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index b4c99ddfc94..fe3a1fdbc12 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -609,13 +609,13 @@ impl WindowMethods for Window { // https://html.spec.whatwg.org/multipage/#dom-window-close fn Close(&self) { + let window_proxy = self.window_proxy(); // Note: check the length of the "session history", as opposed to the joint session history? // see https://github.com/whatwg/html/issues/3734 if let Ok(history_length) = self.History().GetLength() { - // TODO: allow auxilliary browsing contexts created by script to be script-closeable, - // regardless of history length. + let is_auxiliary = window_proxy.is_auxiliary(); // https://html.spec.whatwg.org/multipage/#script-closable - let is_script_closable = self.is_top_level() && history_length == 1; + let is_script_closable = (self.is_top_level() && history_length == 1) || is_auxiliary; if is_script_closable { let doc = self.Document(); // https://html.spec.whatwg.org/multipage/#closing-browsing-contexts diff --git a/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html.ini b/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html.ini deleted file mode 100644 index 9516c5bd53e..00000000000 --- a/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[opener-closed.html] - type: testharness - expected: CRASH - [An auxiliary browsing context should report `null` for `window.opener` when that browsing context is discarded] - expected: CRASH diff --git a/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html.ini b/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html.ini deleted file mode 100644 index d65181dcd1c..00000000000 --- a/tests/wpt/metadata/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[opener-noopener.html] - type: testharness - [Auxiliary browsing context created via `window.open` setting `noopener` should report `window.opener` `null`] - expected: FAIL - diff --git a/tests/wpt/metadata/html/browsers/windows/browsing-context-names/choose-_self-001.html.ini b/tests/wpt/metadata/html/browsers/windows/browsing-context-names/choose-_self-001.html.ini deleted file mode 100644 index 75e00d9632f..00000000000 --- a/tests/wpt/metadata/html/browsers/windows/browsing-context-names/choose-_self-001.html.ini +++ /dev/null @@ -1,6 +0,0 @@ -[choose-_self-001.html] - type: testharness - expected: TIMEOUT - [The current browsing context must be chosen if the given name is "_self"] - expected: TIMEOUT -