mirror of
https://github.com/servo/servo.git
synced 2025-08-01 19:50:30 +01:00
make auxiliary browsing-context script-closeable
This commit is contained in:
parent
a0082c57c8
commit
fee5428316
4 changed files with 3 additions and 19 deletions
|
@ -609,13 +609,13 @@ impl WindowMethods for Window {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
// https://html.spec.whatwg.org/multipage/#dom-window-close
|
||||||
fn Close(&self) {
|
fn Close(&self) {
|
||||||
|
let window_proxy = self.window_proxy();
|
||||||
// Note: check the length of the "session history", as opposed to the joint session history?
|
// Note: check the length of the "session history", as opposed to the joint session history?
|
||||||
// see https://github.com/whatwg/html/issues/3734
|
// see https://github.com/whatwg/html/issues/3734
|
||||||
if let Ok(history_length) = self.History().GetLength() {
|
if let Ok(history_length) = self.History().GetLength() {
|
||||||
// TODO: allow auxilliary browsing contexts created by script to be script-closeable,
|
let is_auxiliary = window_proxy.is_auxiliary();
|
||||||
// regardless of history length.
|
|
||||||
// https://html.spec.whatwg.org/multipage/#script-closable
|
// 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 {
|
if is_script_closable {
|
||||||
let doc = self.Document();
|
let doc = self.Document();
|
||||||
// https://html.spec.whatwg.org/multipage/#closing-browsing-contexts
|
// https://html.spec.whatwg.org/multipage/#closing-browsing-contexts
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue