Safari (and opera) fire two onload events while FireFox fires only one I'm not sure who's correct, but I'm going to lean towards the browser with the larger market share. The "bug" here is exposed by the ordering of the insertion of the iframe into the document and the setting of the url. FireFox only fires the onload event once, after the final URL has been set. Opera and Safari fire the onload handler right when the iframe is inserted, and then again after the src value has been changed. I tried at least once to reduce this and seen the bug go away. I expect it's partially timing related.
Created attachment 16647 [details] test case
Created attachment 16648 [details] test case
The output in IE6 and IE7 is: about to set URL: resources/viewspec-parser.svg Starting: resources/viewspec-parser.svg Only one iframe is loaded. Seems the test needs to be modified to work properly in IE.
Test page: http://bolinfest.com/webkit/iframe_onload.html I would argue that the first onload event fired by Webkit is the problematic one: the body.onload in the iframe should fire first, then the iframe.onload (as it does in Firefox).
I am still able to reproduce the following bug in Safari 15.5 on macOS 12.4. Chrome Canary 104 and Firefox Nightly 102 both - fires "iframe loaded" dialog just once after "Hello World". Test case - http://bolinfest.com/webkit/iframe_onload.html
<rdar://problem/94158603>
Unable to reproduce this in Safari Technology Preview 153 and it just fire "Hello World" and after it, it just load "iframe loaded" dialog once similar to other browsers. I am marking this as "RESOLVED CONFIGURATION CHANGED". Please reopen, if it is reproducible. Thanks! Appreciate if someone can add related Commit details for future reference.