W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

[XHR] Constructor behavior seems to be underdefined

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 30 Mar 2012 16:29:05 -0700
Message-ID: <4F7641C1.9010903@mit.edu>
To: public-webapps@w3.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
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

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....

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:06 UTC