W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

Re: [whatwg] Resource loading in browsing context-less Documents

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 5 Oct 2012 06:00:11 +0000 (UTC)
To: Adam Klein <adamk@chromium.org>
Message-ID: <Pine.LNX.4.64.1210050556260.1904@ps20323.dreamhostps.com>
Cc: whatwg@whatwg.org
On Thu, 4 Oct 2012, Adam Klein wrote:
> With DOMImplementation.createDocument and createHTMLDocument, it's 
> possible to create Document objects that have no associated browsing 
> context. The behavior of elements created by that document is, in some 
> cases, well-specified. For example, <script> tags do not execute if 
> there is no browsing context 
> (http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#concept-n-noscript).
> But some behavior is left unspecified, and is implemented differently 
> across browsers. For example, the following snippet:
>     var doc = document.implementation.createHTMLDocument('myTitle');
>     var img = doc.createElement('img');
>     img.src = 'http://foo.com/myImage.png';
> [...]
> Seems like this should be specced in HTML (not sure whether it would go 
> in each resource fetching algorithm or somewhere more general).

This is specced. The UA is allowed to send the HTTP request (that's a 
truism, of course, nothing stops the UA from sending any arbitrary HTTP 
request at any time), but there's no in-DOM visible effect of that 
request, because event loops don't process tasks for documents without 
active browsing contexts, so the tasks that the "fetch" algorithm 
generates never get executed. (A clever UA can notice this and delay 
(forever) the HTTP requests, since the "fetch" algorithm allows you to 
wait an arbitrary amount of time before doing the request.)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 5 October 2012 06:00:45 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:17 UTC