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
from

Conversation

Projects
None yet
5 participants
@annevk
Copy link
Member

annevk commented Mar 29, 2018

No description provided.

@wpt-pr-bot wpt-pr-bot added the html label Mar 29, 2018

@wpt-pr-bot wpt-pr-bot requested review from ayg, jdm, jgraham and zqzhang Mar 29, 2018

@annevk

This comment has been minimized.

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.)

@w3c-bots

This comment has been minimized.

Copy link

w3c-bots 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

This comment has been minimized.

Copy link
Contributor

bzbarsky commented Mar 29, 2018

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

This comment has been minimized.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.