W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2012

Re: [XHR] Need to define the behavior when the Window the XHR is created from does not have an associated document

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 14 Dec 2012 11:30:20 -0500
Message-ID: <50CB541C.8090706@mit.edu>
To: Jungkee Song <jungkee.song@samsung.com>
CC: public-webapps@w3.org
On 12/14/12 6:49 AM, Jungkee Song wrote:
> FWIW, document.open() does not create a new Window object

Yes, it does.  See 
http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#dom-document-open 
processing steps step 14.  WebKit gets this wrong, but other UAs do it 
right.

>    console.log(defaultDoc.defaultView.name); // "InitWindow"

That's logging the navigation context name.

>      console.log(document.defaultView.name); // "InitWindow"

That's still logging the navigation context name.

>> In particular, in the case above this:
>>
>>     alert(XMLHttpRequest == window.XMLHttpRequest);
>>
>> alerts false per spec as far as I can tell, and the old Window is no
>> longer associated with the document at this point.
>
> In the above example, as both of the two global objects refer to the same
> object, it results in "true".

Did you actually test this in a non-WebKit UA?  The alert above alerts 
false in Gecko, as the spec requires it to.

But note that you can get the same effect by just navigating the a 
browsing context, then calling a function that was defined in the 
no-longer-active document, without worrying about browsers that have 
buggy open() implementations.

-Boris
Received on Friday, 14 December 2012 16:30:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:56 GMT