Bug 28956

Summary: script appended to HEAD during document load executes after window.onload
Product: WebKit Reporter: Ojan Vafai <ojan>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: ap, fishd
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   

Ojan Vafai
Reported 2009-09-03 14:00:10 PDT
In the attached test case, I append two script elements to the head element during document load and console.log the number of elements loaded as each script element loads and at window.onload. I get the following on the console: results.json Resource interpreted as script but transferred with MIME type text/html. race.html:21 Number of loaded results: 1 race.html:25 Number of results at window.onload: 1 results.json Resource interpreted as script but transferred with MIME type text/html. race.html:21 Number of loaded results: 2 The last script element gets executed after window.onload. Unless I'm crazy, all the script elements should be executed before the onload event fires, no? I think it might be a race condition that happens to get regularly triggered by the large size of the script files (~15MB), but that's just a guess. I tested this in a WebKit nightly and Safari 4 on the Mac. Both have the same behavior.
Attachments
Alexey Proskuryakov
Comment 1 2009-09-04 12:57:12 PDT
See also: bug 28783.
Note You need to log in before you can comment on or make changes to this bug.