Skip to content

For #script-closable, clarify when a browsing context is created by script #11208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 22, 2025

Conversation

vinhill
Copy link
Contributor

@vinhill vinhill commented Apr 10, 2025

Introduce an "is created by web content" flag on browsing contexts to determine script-closability. This flag is set when a new top-level traversable is created as a result of window.open(), link navigation, or form submission.

In reference to #1866.

(See WHATWG Working Mode: Changes for more details.)

cc @zcorpan


/document-sequences.html ( diff )
/nav-history-apis.html ( diff )

@zcorpan zcorpan requested a review from annevk April 16, 2025 10:04
source Outdated
@@ -99528,6 +99536,8 @@ interface <dfn interface>NotRestoredReasons</dfn> {

<li><p>An <dfn>is auxiliary</dfn> boolean, initially false.</p></li>

<li><p>An <dfn>is created by web content</dfn> boolean, initially false.</p></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense for this to live on the browsing context? Once there's a COOP-style navigation the tab can no longer be closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think browsers behave in such a way that windows are still script-closable after COOP-style navigations.
Would it be better for the flag to be on Navigable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think in that case it would be.

@domenic or @jakearchibald should probably review as well given that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change and will look into writing a test for this.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me modulo some editorial concerns.

@annevk annevk requested a review from domenic April 17, 2025 10:51
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, modulo the editorial concerns. If you could fix those up I can merge this soon, or I can work on fixing them myself when I have just a bit more extra time.

@domenic domenic merged commit d7fc63a into whatwg:main Apr 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants