[whatwg] Proposal for separating script downloads and execution

Boris Zbarsky bzbarsky at MIT.EDU
Tue Feb 22 10:40:55 PST 2011


On 2/22/11 1:25 PM, Will Alexander wrote:
>> On Thu, 2011-02-17 at 15:24 -0500, Boris Zbarsky wrote:
>>
>> 1)  If your script is no-cache, or max-age:0, does IE make a new
>>     request for it for every<script>  element?
>
> For the most part this seems to be the case but there are two exceptions:
>    a) Before a URL loads, if it's assigned to another script, only one
> request is made.

OK, that would be a violation of the HTTP caching semantics.

>> 2)  If you create a bunch of<script>  elements and set src on them all
>>     and the script returned is different on every GET, and then you run
>>     them, do you see all the different scripts running?
>
> Yes, except for the two cases mentioned above.

OK.

> IE<  9 may mitigate this to some degree by enforcing its standard
> garbage collection rules. If only circular references to the script
> element exist, IE will abort the network request and never fire the
> readystatechange event.
>
> (function(){
>     var s= create('script');
>     s.src= ....
>     s.onreadystatechange= function(){addToDom(this);};
> })();

Uh... In that situation I would expect the event handler to keep the 
script alive until the load finishes.  Anything else is just a bug that 
exposes GC timing to the web page.

-Boris


More information about the whatwg mailing list