Bug 3609 - onload event never called for iframe element with empty or about:blank src
Summary: onload event never called for iframe element with empty or about:blank src
Status: VERIFIED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-18 21:24 PDT by David Kilzer (:ddkilzer)
Modified: 2006-02-25 05:30 PST (History)
3 users (show)

See Also:


Attachments
Test case (2.00 KB, patch)
2005-06-18 21:41 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Handy in-browser test case (376 bytes, text/html)
2005-06-18 21:47 PDT, David Kilzer (:ddkilzer)
no flags Details
patch for an existing test case (969 bytes, patch)
2006-02-11 11:18 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff
Handy in-browser test case (no race condition) (376 bytes, text/html)
2006-02-25 05:30 PST, David Kilzer (:ddkilzer)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2005-06-18 21:24:38 PDT
Summary: 

The onload event of an iframe element is never called, even after the content of the iframe element has 
been loaded.

Steps to Reproduce: 

See attached test case.

Expected Results: 

The onload event of the iframe element is called if it exists.

Actual Results: 

The onload event of the iframe element is never called.

Regression: 

N/A

Notes: 

N/A
Comment 1 David Kilzer (:ddkilzer) 2005-06-18 21:26:46 PDT
As originally noted in this message to webkit-dev:

http://www.opendarwin.org/pipermail/webkit-dev/2005-June/000125.html

I also found this bug on W3C's Bugzilla site that provides a work-around:

http://www.w3.org/Bugs/Public/show_bug.cgi?id=228
Comment 2 David Kilzer (:ddkilzer) 2005-06-18 21:41:28 PDT
Created attachment 2469 [details]
Test case

Test case which currently breaks (as it should since this issue hasn't been
fixed).
Comment 3 David Kilzer (:ddkilzer) 2005-06-18 21:45:17 PDT
Regarding Comment 1, the W3C Bugzilla bug provides a workaround in their JavaScript (ECMAScript) test 
suite, which uses JSUnit.  Fixing this bug may also make JSUnit work better with Safari.

http://www.edwardh.com/jsunit/
Comment 4 David Kilzer (:ddkilzer) 2005-06-18 21:47:10 PDT
Created attachment 2470 [details]
Handy in-browser test case

The text on the screen should change to "IFrame OnLoad Event Called" when the
test page is loaded, but doesn't.
Comment 5 Eric Seidel (no email) 2005-12-28 22:21:07 PST
I just ran into this today.  This is really annoying... :(
Comment 6 Eric Seidel (no email) 2005-12-28 22:32:03 PST
Part of what might make this hard, is that currently sometimes the RenderTree does the loading, and 
sometimes the DOMTree does the loading for <object> tags.  Although I'm still not familiar enough with 
how onload events work to know.

HTMLObjectElementImpl::parseMappedAttribute() definitely creates an onload event listener if specified.  
I'm not sure how that onload event listener is supposed to be fired however.

It looks like Image onload events are special cased.  Those seem to be the only ones we support other 
than <body> onload event listeners.

SVG will need generic onload handing as well.
Comment 7 Geoffrey Garen 2005-12-31 10:18:57 PST
I suspect the same bug applies to onunload, onbeforeunload, etc.
Comment 8 Alexey Proskuryakov 2006-02-09 14:13:29 PST
This problem has been fixed very recently (between revisions r12598 and r12724). I'm not closing this bug yet, because:
1) according to comment 7, investigation of onunload/onbeforeunload/etc behavior may be needed;
2) if the fix was an unintentional side effect, landing an additional test case for this would be highly desirable.

Please note that the attached test case still fails because of bug 7161 - but the onload handler now gets actually called (you can add an alert() to verify).
Comment 9 Alexey Proskuryakov 2006-02-11 11:18:48 PST
Created attachment 6414 [details]
patch for an existing test case

This was fixed intentionally in r12638 - this bug was mentioned in the log entry, and a test was included. There is a small typo in the test; the attached patch fixes it.

Apparently, onunload and onbeforeunload are not supposed to work (they don't in WinIE, Firefox and Opera).
Comment 10 Darin Adler 2006-02-11 15:20:33 PST
Comment on attachment 6414 [details]
patch for an existing test case

Oops! r=me
Comment 11 David Kilzer (:ddkilzer) 2006-02-25 05:30:18 PST
Created attachment 6728 [details]
Handy in-browser test case (no race condition)
Comment 12 David Kilzer (:ddkilzer) 2006-02-25 05:30:58 PST
Verified bug is fixed.