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

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 UTC