[Webkit-unassigned] [Bug 55132] New: DOMContentLoaded event is fired too early if scripts are inserted dynamically

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Feb 24 04:15:22 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=55132

           Summary: DOMContentLoaded event is fired too early if scripts
                    are inserted dynamically
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
               URL: http://www.zeit.de/politik/ausland/2011-02/libyen-gadh
                    afi-proteste-staemme
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: trev at adblockplus.org


Created an attachment (id=83631)
 --> (https://bugs.webkit.org/attachment.cgi?id=83631&action=review)
Testcase

It seems that WebKit's DOMContentLoaded event fails to consider dynamically inserted scripts properly. If a webpage inserts scripts dynamically during load Gecko and Opera will allow these scripts to run (they might still call document.write and such) and will only fire DOMContentLoaded event then. WebKit however ignores dynamically inserted scripts - DOMContentLoaded is fired immediately after the last "static" script finished executing. The attached testcase exemplifies this, it will check for two scripts whether they had a chance to run before DOMContentLoaded and "load" events. The expected result is that on DOMContentLoaded both scripts already executed - that's what I see in Firefox 3.6.13 and Opera 9.64. In Chrome 9.0.597.98 and Safari 4.0 however the dynamically inserted script didn't run on DOMContentLoaded, that is only the case when the "load" event is fired.

I originally came across this issue on http://www.zeit.de/politik/ausland/2011-02/libyen-gadhafi-proteste-staemme. The map there works by inserting a bunch of scripts into the document. One of these scripts will run on DOMContentLoaded (via jQuery.ready()) and expects the other scripts to be loaded. However, this isn't always the case in Chrome, it is rather a race condition.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list