Bug 31660 - REGRESSION (r49394): Image load event fires before the document fragment is attached.
Summary: REGRESSION (r49394): Image load event fires before the document fragment is a...
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
URL: http://klout.com/profile/stats/ghosttie/
Keywords: InRadar
Depends on:
Reported: 2009-11-18 21:37 PST by Dimitri Glazkov (Google)
Modified: 2009-12-14 13:47 PST (History)
4 users (show)

See Also:

test case (699 bytes, text/html)
2009-12-14 11:39 PST, Alexey Proskuryakov
no flags Details
proposed fix (7.45 KB, patch)
2009-12-14 13:12 PST, Alexey Proskuryakov
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
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

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