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

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 UTC