Open
Bug 621553
Opened 14 years ago
Updated 2 years ago
Implement HTML5 Specification Suggestion to Download Scripts Upon SRC attribute Assignment
Categories
(Core :: General, defect)
Tracking
()
UNCONFIRMED
People
(Reporter: serverherder, Unassigned)
References
()
Details
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.6.13-1.fc13 Firefox/3.6.13 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.6.13-1.fc13 Firefox/3.6.13 The HTML5 specification makes a suggestion in running a script, step 12 http://www.w3.org/TR/html5/scripting-1.html#running-a-script "For performance reasons, user agents may start fetching the script as soon as the attribute is set, instead, in the hope that the element will be inserted into the document." Currently only IE (4+) implement this behavior -- The test URL above loads the scripts in approximately 5 seconds, as opposed to Firefox loading them in 10. Were Firefox to implement this suggestion, both parallel loading dependencies and pre-fetching script elements for deferred execution would be rather simple to implement. Reproducible: Always In FF <=3.6, workarounds exist that rely on FF's execution order preservation; however, this behavior contradicts the HTML5 specification and has been removed in FF 4. This has lead to the the `async=true` implementation. which reverts FF back to synchronous execution. While this works, the specification only defines behavior for the async attribute on parser-inserted scripts. Moreover, using async=true requires utilizing a global script queue, which can lead to the blocking current versions of Firefox are prone to.
Updated•14 years ago
|
Product: Firefox → Core
QA Contact: general → general
![]() |
||
Comment 1•14 years ago
|
||
It's actually really hard to do this without leaking memory....
Reporter | ||
Comment 2•14 years ago
|
||
I can imagine. Not sure if it helps (or is even related), but Internet Explorer aborts outstanding network connections if the JS variable is garbage collected -- A reference to the element must be maintained while it is in-flight. For example, this will abort in IE (sometimes) (function(){ var i=0; while ( i++ <= 10 ) { var script= document.createElement('script'); script.onreadystatechange= function(){ document.body.appendChild(this); } script.src= "...."; } })() A reference to each element must be maintained to prevent GC from occurring. Would this make it easier to prevent leaks?
![]() |
||
Comment 3•14 years ago
|
||
The script loader in Gecko holds a reference to the element being loaded. So it wouldn't be able to get garbage collected.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•