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

Re: [XHR] Constructor behavior seems to be underdefined

From: Brendan Eich <brendan@mozilla.org>
Date: Fri, 30 Mar 2012 21:22:11 -0700
Message-ID: <4F768673.7010007@mozilla.org>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: public-webapps@w3.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC