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

[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: Thu, 13 Dec 2012 12:50:10 -0500
Message-ID: <50CA1552.9060509@mit.edu>
To: public-webapps@w3.org
The spec currently says:

   In environments where the global object is represented by the Window
   object the XMLHttpRequest object has an associated XMLHttpRequest
   document which is the document associated with the Window object for
   which the XMLHttpRequest interface object was created.

Now consider this testcase:

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

What is the "XMLHttpRequest document" in this case?  Note that 
document.open() creates a new Window object in this case, but the 
unqualified name lookup finds the XMLHttpRequest constructor on the old 
Window still.  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.

What should happen in this case?

-Boris
Received on Thursday, 13 December 2012 17:50:40 GMT

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