Repository navigation
Make window.name deal with lack of browsing context - #4366
Conversation
|
As discussed in IRC, this reveals some fractal brokenness. The current spec seems to assume that there is always a strong reference from Window -> BC. Discarding only removes the strong reference from UA -> BC; if some script holds a JS -> Window reference, then BC stays alive. The tests in web-platform-tests/wpt#15391 indicate, however, that window.name returns the empty string (and thus, setting is a no-op) for any Window attached to an iframe that was .remove()ed. So this PR is indeed doing something right. I see two ways forward:
I lean toward (1), with follow-up work being to guard all Window -> BC references with a null check. But, I am a bit scared that we have this long-standing assumption in the spec of an always-existing Window -> BC link. I'd love to hear from folks like @bzbarsky and @jdm. |
|
Oh, well, it turns out the spec doesn't seem to have any definition of a Window -> BC pointer, only a document -> BC pointer. It assumes and uses a Window -> BC pointer a lot. But in #4363 (comment) @annevk suggests defining "Window's BC" to be "Window's associated document's BC", or null if Window has no associated document. I'm unsure what the implications would be there, as I can't immediately see if "discard" severs the Document -> BC relationship. But, it's something to consider. |
|
https://html.spec.whatwg.org/multipage/window-object.html#a-browsing-context-is-discarded seems to say that the document's BC relationship would be severed but other references to the BC remain valid. |
|
Note also that the specification already has this:
|
|
With #4368 as a foundation I'm happy with (1). It looks like that makes it properly clear that after discarding, a Document's BC and thus the Window's BC is null. |
Previously, a Document could sometimes "have no browsing context". Now, "a Document's browsing context" is either a browsing context or null. Previously, "a Window's browsing context" was not defined, despite being referenced extensively. Now, it is defined to be the Window's associated Document's browsing context. Related to #3846, #4363, and #4366.
496364c to
f9cc3c2
Compare
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 2eb522ceb6e1c842c8c5b2950d4a4ab2ef88268c
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 9acf395a6242f447db603b86c78f32f722081cf9
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 2eb522ceb6e1c842c8c5b2950d4a4ab2ef88268c
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 9acf395a6242f447db603b86c78f32f722081cf9
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 2eb522ceb6e1c842c8c5b2950d4a4ab2ef88268c
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391 UltraBlame original commit: 9acf395a6242f447db603b86c78f32f722081cf9
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Automatic update from web-platform-tests HTML: window.name For whatwg/html#4366. -- wpt-commits: 8e76fc76d3af0a56d0ccdd627fe844fd9c5a1554 wpt-pr: 15391
Tests: web-platform-tests/wpt#15391.
Helps with #4363.
/window-object.html ( diff )