[XHR] Constructor behavior seems to be underdefined

As far as I can tell, the WebIDL specification doesn't define anything 
about what really happens when a constructor is invoked, once the 
arguments have been converted to the IDL types, except the conversion of 
the return value from an IDL type to an ES type.  It defers the exact 
behavior of the constructor to the specification defining the constructor.

XHR2 currently says in http://www.w3.org/TR/XMLHttpRequest2/#constructors :

   The XMLHttpRequest() constructor must return a new XMLHttpRequest
   object.

and in http://www.w3.org/TR/XMLHttpRequest2/#origin-and-base-url :

   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 a web page with two subframes and a script that has 
references to the two subframe windows in variables w1 and w2.  Then the 
script does this:

   w1.XMLHttpRequest = w2.XMLHttpRequest;
   var xhr = new w1.XMLHttpRequest();

What's the document associated with xhr?  Is it w1.document, 
w2.document, or window.document?  The concept "the Window object for 
which the XMLHttpRequest interface object was created" doesn't seem to 
be defined anywhere....

-Boris

Received on Friday, 30 March 2012 23:29:35 UTC