Re: [XHR] Constructor behavior seems to be underdefined

See the [[Scope]] internal property of function objects from ECMA-262 
13.2, 10.4.3, etc.

/be

Boris Zbarsky wrote:
> 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 Saturday, 31 March 2012 04:22:43 UTC