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
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
Created attachment 2469 [details] Test case Test case which currently breaks (as it should since this issue hasn't been fixed).
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/
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.
I just ran into this today. This is really annoying... :(
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.
I suspect the same bug applies to onunload, onbeforeunload, etc.
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).
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 on attachment 6414 [details] patch for an existing test case Oops! r=me
Created attachment 6728 [details] Handy in-browser test case (no race condition)
Verified bug is fixed.