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 13:31:23 -0500
Message-ID: <50CB707B.5090502@mit.edu>
To: Anne van Kesteren <annevk@annevk.nl>
CC: Jungkee Song <jungkee.song@samsung.com>, public-webapps@w3.org
On 12/14/12 1:26 PM, Boris Zbarsky wrote:
>> That would mean
>> http://xhr.spec.whatwg.org/#dom-xmlhttprequest is bogus. If a Window
>> object potentially has a Document object given this edge case I
>> suppose what I would propose is that when it does not have one, XHR's
>> document is set to null, and we throw for xhr.open().
>
> It would actually be easier to throw from the constructor, from an
> implementation point of view...  But we could make either one work, I
> guess.

Though the real question is whether this:

   <script>
     window.onload = function() {
       document.open();
       var xhr = new XMLHttpRequest();
       xhr.open("GET", "");
       xhr.send();
     }
   </script>

should really throw or not...  It's a slightly weird case where the 
Window the code is running in is no longer the currently active Window 
but the page is sort of still around, kinda.

-Boris
Received on Friday, 14 December 2012 18:31:55 GMT

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