load event not raise for nested iframes without src




Document Navigation
2 years ago
2 years ago


(Reporter: miherlosev, Unassigned)


(Depends on: 1 bug)

42 Branch

Firefox Tracking Flags

(Not tracked)




2 years ago
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20151029151421

Steps to reproduce:

1)Create a page with the following markup:
		<h1>Top level document</h1>
			var iframe = document.createElement('iframe');
			iframe.id = 'iframe1';
			iframe.addEventListener('load', function () {
				var iframeDocument = this.contentDocument;
				var nestedIframe = iframeDocument.createElement('iframe');
				nestedIframe.id = 'iframe2';
				nestedIframe.addEventListener('load', function () {
					alert('nested iframe load event');
2)Open it in browser

Actual results:

Alert with text 'nested iframe load event' didn't show

Expected results:

I expect the alert with text 'nested iframe load event'
Confirmation: I also fail to see an alert display. Is this desired behavior or should an alert display?
Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:42.0) Gecko/20100101 Firefox/42.0
Ever confirmed: true


2 years ago
Component: Untriaged → Layout: HTML Frames
Product: Firefox → Core
The relevant spec bit starts at https://html.spec.whatwg.org/#the-iframe-element:process-the-iframe-attributes I believe.

What that will do is jump to https://html.spec.whatwg.org/#process-the-iframe-attributes and land in the

  Otherwise, if the element has no src attribute specified, and the user agent is
  processing the iframe's attributes for the "first time"

case, which is in fact supposed to queue up a load event.

In our case the problem is that we do the frame recursion check before we create the child browsing context, iirc, so we never perform the about:blank load in this case (because the parent document has the same URI) and we don't have a special-case for firing onload manually in the no-src case, because we depend on the about:blank load to do that.

Fixing this probably requires sorting out 543435 and company and in general aligning closer with the spec in terms of about:blank handling for iframes...

Michelle, note that this is not a layout issue; load events are not dependent on layout.  One way to tell in general whether something is a layout issue or not, by the way, is whether doing all the same things in a display:none subtree shows the same problem.
Component: Layout: HTML Frames → Document Navigation
Depends on: 543435
Duplicate of this bug: 1265378
Note that this is conceptually similar to bug 473396 and that when I tried to just skip the recursion check for about:blank in that bug things _still_ did not work, precisely because of the non-sync about:blank issues.
You need to log in before you can comment on or make changes to this bug.