Skip to content
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

Use DOM's post-connection steps for <iframe> elements #10840

Merged
merged 2 commits into from
Dec 12, 2024

Conversation

domfarolino
Copy link
Member

@domfarolino domfarolino commented Dec 9, 2024

In whatwg/dom#1261, the concept of DOM post-connection steps were introduced, as a checkpoint to run scripts and create browsing contexts synchronously during insertion, but after all DOM mutations are complete. After that, #10188 landed to make use of the post-connection steps for <script> elements, but no such PR was made for <iframe> elements, despite 2/3 browser engines implementing iframe insertion with post-connection steps, and no strong objections from the third (Gecko). This PR updates the iframe processing model to create its nested navigable/browsing context during the element's post-connection steps, instead of the normal insertion steps. Fixes #10828.

@smaug---- Are you on board with this? Is it fair to say there are no strong objections for using this timing for <iframe> elements, as Chromium and WebKit do?


/iframe-embed-object.html ( diff )

@smaug----
Copy link

I'm a bit confused. How does Gecko not have post-connection steps? I mean, conceptually scriptrunners do that.
Or has something else landed to the spec which I'm not aware of?
"2/3 browser engines implementing" hints that Gecko is somehow different, but I don't know how.

@domfarolino
Copy link
Member Author

@smaug---- I’m just going off the WPT results linked above—Firefox fails the insertion test. Gecko may well be capable of implementing post-connection timing via ScriptRunners, but it seems to not use that capability for iframe insertion.

@smaug----
Copy link

Ah, but that is just about the load event, no?

@domfarolino
Copy link
Member Author

Well the load event is the only way an earlier-inserted frame can observe that a later-inserted iframe’s content window is null, and has not yet been created yet, because the nested document is created during the post-connection steps, at the same timing as the load event. So it is about the load event, but also about nested document creation.

@smaug----
Copy link

One could mix script elements and iframes in the test, no? Earlier script accessing iframe. (though I think Gecko would synchronously create a content window when accessed first time.)

@domenic domenic merged commit c8ec987 into main Dec 12, 2024
2 checks passed
@domenic domenic deleted the iframe-post-connection-steps branch December 12, 2024 03:38
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.

Iframe insertion steps violate rules for what insertion steps are allowed to do
3 participants