Repository navigation
Refactor browsing context creation - #4284
Conversation
Some initial work to make introducing browsing context groups easier.
mystor
left a comment
There was a problem hiding this comment.
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.
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.
- https://html.spec.whatwg.org/#apis-for-creating-and-navigating-browsing-contexts-by-name:top-level-browsing-context
- https://html.spec.whatwg.org/#focus-management-apis:top-level-browsing-context
- https://html.spec.whatwg.org/#focus-processing-model:top-level-browsing-context
| 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.
Same two-steps comment as above
There was a problem hiding this comment.
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.
| <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.
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.
|
web-platform-tests/wpt#15078 has tests. |
domenic
left a comment
There was a problem hiding this comment.
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> |
|
|
||
| <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.
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 )