-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Refactor browsing context creation #4284
Conversation
Some initial work to make introducing browsing context groups easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a pretty good improvement to me :-) - I don't have as much context as some other contributors to the spec as to other places which might need to be updated, but the parts I see here look pretty good.
I added some comments which are somewhat style-focused - feel free to disregard them.
We might want to propagate some sandboxing information into IIRC we do / want to do some propagation of e.g. popup blocking flags into |
Edit: so per some local testing sandboxing as well as name setting goes for both auxiliary and non-auxiliary top-level browsing contexts. The difference between auxiliary and non-auxiliary top-level browsing contexts is only whether you get a reference (opener/openee) and session storage, as far as I can tell. It'd be great if someone could confirm. (E.g., @mikewest.) I'll make the patch reflect that, even if it seems less than ideal. |
Note: this fixes #2645. |
The annoying thing with refactoring is that you always run into new things:
I'll try to sort that out and also a restructuring of the sections that it requires as well as writing some tests I suppose. It'd be good to get this done though as this blocks making target=_blank behave like noopener, adding Cross-Origin-Opener-Policy, browsing context groups, etc. |
Tests to write (though perhaps noopener bits should be lightly tested given #1826 will likely change things a bit):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some editorial suggestions. But my biggest concern is changing the definition of "top-level browsing context" to exclude auxiliary BCs. There seem to be ~50 uses of "top-level browsing context" in this spec alone. How many of those change their meaning substantially now?
Spot-checking, many of them now seem broken, e.g.
source
Outdated
@@ -31164,7 +31184,8 @@ interface <dfn>HTMLObjectElement</dfn> : <span>HTMLElement</span> { | |||
|
|||
<p>If the <code>object</code> element's <span>nested browsing context</span> is null, set | |||
the element's <span>nested browsing context</span> to a <span data-x="creating a new | |||
browsing context">newly-created browsing context</span>.</p> | |||
browsing context">newly-created browsing context</span> with the element's <span>node | |||
document</span>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same two-steps comment as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is much harder as it's knee-deep in an existing algorithm. So you cannot really abstract object element
out without rewriting the entire thing.
@@ -77343,6 +77363,46 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> { | |||
<span>top-level browsing context</span>'s <code>WindowProxy</code> object.</p></li> | |||
</ol> | |||
|
|||
<p>The <dfn><code data-x="dom-opener">opener</code></dfn> attribute's getter must run these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this last, if you want to keep it in the same section. top/parent are both about navigating the tree, whereas this is about crossing to a new tree, kinda. Feels different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put it in IDL order.
web-platform-tests/wpt#15078 has tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Do you think maybe "create a new top-level browsing context" should get a new name, since it's immediately followed by "create a new auxiliary browsing context"? Or maybe just a clarifying note that "create a new auxiliary browsing context" is a more specialized way of creating a certain type of top-level BC.
I think in the future we could also have a "create a nested BC" algorithm which takes an element; that would be a nice cleanup.
browsing context</span>. <span w-nodev>When the browsing context is created, if the attribute | ||
is present, the <span>browsing context name</span> must be set to the value of this attribute; | ||
otherwise, the <span>browsing context name</span> must be set to the empty string.</span></p> | ||
browsing context</span>.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to move this.
@@ -76949,7 +76960,8 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> { | |||
<p>A <span>browsing context</span> has an <dfn data-export="">opener browsing context</dfn>, which | |||
is null or a <span>browsing context</span>. It is initially null.</p> | |||
|
|||
<p>A <span>browsing context</span> can be <dfn id="disowned-its-opener">disowned</dfn>.</p> | |||
<p>A <span>browsing context</span> can be <dfn id="disowned-its-opener">disowned</dfn>, which is a | |||
boolean. It is initially false.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehh, "can be disowned, which is a boolean" is not really grammatical. "Has a disowned boolean" would be better.
…nested browsing context, a=testonly Automatic update from web-platform-tests HTML: window.open() can set opener of a nested browsing context Needed for whatwg/html#4284. -- wpt-commits: 5cf7f41336801449ce7499a5f41ccf6848650e9c wpt-pr: 15078
…nested browsing context, a=testonly Automatic update from web-platform-tests HTML: window.open() can set opener of a nested browsing context Needed for whatwg/html#4284. -- wpt-commits: 5cf7f41336801449ce7499a5f41ccf6848650e9c wpt-pr: 15078
…nested browsing context, a=testonly Automatic update from web-platform-tests HTML: window.open() can set opener of a nested browsing context Needed for whatwg/html#4284. -- wpt-commits: 5cf7f41336801449ce7499a5f41ccf6848650e9c wpt-pr: 15078 UltraBlame original commit: 5eb72f3fdd6a5d8a9f9eb3015af3522b7196fcb2
…nested browsing context, a=testonly Automatic update from web-platform-tests HTML: window.open() can set opener of a nested browsing context Needed for whatwg/html#4284. -- wpt-commits: 5cf7f41336801449ce7499a5f41ccf6848650e9c wpt-pr: 15078 UltraBlame original commit: 5eb72f3fdd6a5d8a9f9eb3015af3522b7196fcb2
…nested browsing context, a=testonly Automatic update from web-platform-tests HTML: window.open() can set opener of a nested browsing context Needed for whatwg/html#4284. -- wpt-commits: 5cf7f41336801449ce7499a5f41ccf6848650e9c wpt-pr: 15078 UltraBlame original commit: 5eb72f3fdd6a5d8a9f9eb3015af3522b7196fcb2
Some initial work to make introducing browsing context groups easier.
In particular:
@mikewest currently "choosing a browsing context" has some sandboxing integration. It seems this can move to "creating a new auxiliary browsing context"? I haven't made that change yet, but it seems like that's what should happen as presumably it doesn't apply when we create a new non-auxiliary top-level browsing context.
cc @mystor @farre
/browsers.html ( diff )
/iframe-embed-object.html ( diff )
/index.html ( diff )
/links.html ( diff )
/obsolete.html ( diff )
/urls-and-fetching.html ( diff )
/webappapis.html ( diff )
/webstorage.html ( diff )
/window-object.html ( diff )