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

document.open() and the load event #10239

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

annevk
Copy link
Member

@annevk annevk commented Mar 29, 2018

No description provided.

@wpt-pr-bot wpt-pr-bot requested review from ayg, jdm, jgraham and zqzhang March 29, 2018 12:33
@annevk
Copy link
Member Author

annevk commented Mar 29, 2018

@bzbarsky I tried to figure out what browsers do with the load event because of your comments in #10209 and I'm not much wiser. This test passes in Safari and fails everywhere else (it fails in Firefox because Firefox loses the written content; it fails in Chrome and Edge because they dispatch a normal load event on the window).

I did notice that Chrome has some logic for the load event here: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/dom/Document.cpp?l=3031. And indeed if I don't wait for the iframe's load event, but open() directly, the window's load event won't fire and that seems interoperable across browsers. (I will add that test later as it seems good to have as a baseline.)

@ghost
Copy link

ghost commented Mar 29, 2018

Build PASSED

Started: 2018-03-29 12:33:29
Finished: 2018-03-29 12:43:54

View more information about this build on:

@bzbarsky
Copy link
Contributor

it fails in Firefox because Firefox loses the written content

It fails in Firefox because step_timeout with a 0 delay fires before the load event for the frame and the open/write that load event triggers. Which is totally allowed per spec, because they use different task sources ("DOM manipulation task source" for the load event, "timer task source" for the setTimeout(func, 0) call).

Furthermore, as the test is written right now, the step_timeout bit can even run before parsing of the HTML completes, hence definitely before the load event for the page would fire no matter what's happening with the subframe...

@annevk
Copy link
Member Author

annevk commented May 3, 2018

I adjusted the test a bit, but now it fails in no browser.

I think the main difference between browsers is what happens when you invoke the document open steps during the frame's load event.

I'll add something for that.

@TimothyGu TimothyGu self-assigned this Jul 31, 2018
@gsnedders gsnedders closed this Jan 24, 2020
@gsnedders gsnedders deleted the annevk/document-open-load-event branch January 24, 2020 18:01
@gsnedders gsnedders restored the annevk/document-open-load-event branch January 24, 2020 18:46
@Hexcles Hexcles reopened this Jan 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants