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

"mute iframe load" flag doesn't seem to accurately capture what UAs do #4292

Open
bzbarsky opened this issue Jan 15, 2019 · 5 comments
Open

Comments

@bzbarsky
Copy link
Contributor

I don't quite know how to reconcile this with #4291 but...

Consider the following testcase:

<script>
function doIt() {
  log.textContent += "called";
  var doc = frames[0].document;
  doc.open();
  doc.defaultView.addEventListener("load", () => console.log('load'));
  doc.write("testing");
  doc.close();
}
</script>
<div id=log></div>
<iframe onload="doIt()"> </iframe>

Per spec as written, it should log "load" at some point, but it does not. The spec's "mute iframe load" flag prevents doIt being called a second time, but what UAs are doing is more than that: they're not firing the load event at all on the window in the iframe in this case after the close() call, as far as I can see. And that's even true if I add an <img src> to that DOM...

I haven't tested what happens if I call doIt from the load event firing on the window in the subframe instead of from the load event firing on the iframe element, by the way. At least in Gecko I expect that to also suppress the load event for the written document.

@bzbarsky
Copy link
Contributor Author

@TimothyGu @domenic @annevk

@bzbarsky
Copy link
Contributor Author

Hmm. Actually, looking at the spec again I guess the "iframe load in progress" flag is set when doIt is called, so open() sets the mute iframe load flag, and hence "load" should not get logged per spec?

@annevk
Copy link
Member

annevk commented Feb 27, 2019

Yeah, that seems to be the case. It's very strange however that this is only a flag for iframe elements, despite embed, object, and frame likely having similar problems.

@bzbarsky
Copy link
Contributor Author

Yeah, in Gecko I'm flagging this on the document itself, not the iframe element...

@domenic
Copy link
Member

domenic commented Mar 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants