Bug 31660

Summary: REGRESSION (r49394): Image load event fires before the document fragment is attached.
Product: WebKit Reporter: Dimitri Glazkov (Google) <dglazkov>
Component: DOMAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bdakin, darin, hyatt
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://klout.com/profile/stats/ghosttie/
Attachments:
Description Flags
test case
none
proposed fix hyatt: review+

Description Dimitri Glazkov (Google) 2009-11-18 21:37:52 PST
What happens here is this:

* site loads some HTML via XHR
* then attempts to inject it into DOM
* as the HTML is being parsed, we encounter an image element with an onload handler
* image has already been loaded on the site, so we fire the onload handler immediately
* onload handler attempts to document.getElementById the element in the fragment.
* fragment isn't yet attached to DOM
* sadness ensues.

Originally reported at http://cbug.com/27148.
Comment 1 Alexey Proskuryakov 2009-11-20 14:36:28 PST
<rdar://problem/7414289>
Comment 2 Alexey Proskuryakov 2009-12-14 10:36:06 PST
What steps will reproduce the problem?
1. Go to http://klout.com/profile/stats/ghosttie/

What is the expected result?

A flash graph

What happens instead?

A message saying "Flash Player version 8 or above is required to view the 
chart".  Flash version 10 is installed and works fine on other sites.
Comment 3 Alexey Proskuryakov 2009-12-14 11:39:00 PST
Created attachment 44808 [details]
test case

Test case made from the above description. I haven't looked at the actual site to verify how it fails.
Comment 4 Alexey Proskuryakov 2009-12-14 13:12:49 PST
Created attachment 44815 [details]
proposed fix
Comment 5 Dave Hyatt 2009-12-14 13:43:47 PST
Comment on attachment 44815 [details]
proposed fix

r=me
Comment 6 Alexey Proskuryakov 2009-12-14 13:47:37 PST
Committed <http://trac.webkit.org/changeset/52116>.