Issue 578812 in chromium: Load event for iframe with javascript src raised twice

288 views
Skip to first unread message

chro...@googlecode.com

unread,
Jan 18, 2016, 7:51:06 AM1/18/16
to chromi...@chromium.org
Status: Unconfirmed
Owner: ----
Labels: Cr-Blink Pri-2 Via-Wizard Type-Bug OS-Windows

New issue 578812 by mlose...@gmail.com: Load event for iframe with
javascript src raised twice
https://code.google.com/p/chromium/issues/detail?id=578812

UserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101
Firefox/43.0

Steps to reproduce the problem:
Open in chrome the page with the following markup:
<html>
<head>
</head>
<body>
<script>
var iframe = document.createElement('iframe');
iframe.id = 'iframe_with_javascript_protocol';
iframe.src = 'javascript:"<html><body>test</body></html>"';
iframe.addEventListener('load', function() {
console.log('load event');
});
document.body.appendChild(iframe);
</script>
</body>
</html>
If the load event is raised, the 'load event' message is added to
the 'Console' browser tab.

What is the expected behavior?
I expect that load event is raised 1 time.

What went wrong?
In Chrome it is raised 2 times, in IE11 - 1 time, in FF - 1 time.

Did this work before? No

Chrome version: 47.0.2526.111 Channel: stable
OS Version: 8.1
Flash Version: Shockwave Flash 20.0 r0

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

chro...@googlecode.com

unread,
Jan 18, 2016, 2:03:13 PM1/18/16
to chromi...@chromium.org
Updates:
Labels: -Cr-Blink Cr-Blink-Loader

Comment #1 on issue 578812 by dtapu...@chromium.org: Load event for iframe
(No comment was entered for this change.)

chro...@googlecode.com

unread,
Jan 25, 2016, 8:32:39 AM1/25/16
to chromi...@chromium.org

Comment #2 on issue 578812 by brat...@opera.com: Load event for iframe with
If there is no previous document, javascript urls first load an about:blank
document to execute the script in. That may be the cause of the unexpected
load event.

chro...@googlecode.com

unread,
Jan 29, 2016, 1:36:19 AM1/29/16
to chromi...@chromium.org
Updates:
Owner: hirosh...@chromium.org
Cc: jap...@chromium.org

Comment #3 on issue 578812 by kin...@chromium.org: Load event for iframe
Nate or hiroshige-san: do you think you could take a look to see if it's
real?

chro...@googlecode.com

unread,
Jan 29, 2016, 2:55:29 AM1/29/16
to chromi...@chromium.org
Updates:
Status: Assigned

Comment #4 on issue 578812 by hirosh...@chromium.org: Load event for iframe
Confirmed.

chro...@googlecode.com

unread,
Jan 29, 2016, 3:32:37 AM1/29/16
to chromi...@chromium.org

Comment #5 on issue 578812 by hirosh...@chromium.org: Load event for iframe
First, the load handler is called before the JavaScript URL is executed
in loadOrRedirectSubframe()
called in HTMLFrameElementBase::openURL().
(Just like the load handler is called sync when an <iframe> with empty src).

Second, the load handler is called after the JavaScript URL is executed
in DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL()
called in FrameLoader::replaceDocumentWhileExecutingJavaScriptURL()
called in ScriptController::executeScriptIfJavaScriptURL()
called in HTMLFrameElementBase::openURL().

We have to omit the first load handler invocation.

Issue 569511 resolves this, because the first load invocation becomes async
and we can cancel it.
Reply all
Reply to author
Forward
0 new messages