-
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
Spec for iframe removal from the document doesn't match browser behavior #4611
Comments
One simple solution for the Another solution would be to align all UAs with the spec on the unload behavior of removing |
This might actually be correct... In any case, this test ended up triggering Gecko assertions with some other unrelated changes I was making, which is how I ended up looking into this. |
When we fix this, timing of |
cc @nox |
I'd be curious to hear from browsers what they do here. It seems like there are a few things in play:
|
Hmm. I was going to say that https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps step 5 would no-op that, but of course the script nesting level would still be 0 here. I'm not sure what browsers actually do in practice here; I'll try to write a testcase if no one beats me to it. |
As I noted elsewhere, what Chrome/Safari do is the equivalent of mutation events, so if the plan is still to get rid of those, that behavior would be best avoided. |
So I came to this issue after looking at whatwg/dom#808 and thinking more about how to resolve it from the perspective of invoking a node's removing steps hook during removal. This issue seemed to originally be about:
It was said earlier in this thread that Chrome/Safari agree on clearing the browsing context after the It seems that in an iframe's
Assuming "deferred removal steps" means "executing Related: another example I can think of is removing a focused
|
What about pagehide? I don't think anyone is trying to deprecated that and it fires around the same time as unload. |
Good call on I'll amend the WPTs in web-platform-tests/wpt#44308 to show this more explicitly. Then spec-wise to close this issue out I think we just need to make HTML fire the "unload" algorithm upon child navigable destruction. At least that's the gist. It's not quite that simple because some of the unload algorithms seem to unconditionally queue tasks, which wouldn't match implementations right now. Footnotes
|
Consider this testcase:
Should anything get logged? Per spec, no, because:
followed by a note that
But Firefox, Chrome, and Safari all fire an unload event in this situation.
Of particular interest, that means that in those browsers https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps step 11 can re-enter document.open, as far as I can tell. It's not clear to me how that's supposed to work. There's a web platform test at
html/browsers/browsing-the-web/unloading-documents/004.html
that sort of ends up exercising this, but it has various issues (likehtml/browsers/browsing-the-web/unloading-documents/support/004b.html
openingparent.document
but then writing and closingdocument
which mean that no one passes it right now...@annevk @TimothyGu @domenic
The text was updated successfully, but these errors were encountered: