Re: [webidl] XMLHttpRequest interface object

On Apr 30, 2009, at 9:58 AM, Ian Hickson wrote:

> On Thu, 30 Apr 2009, Anne van Kesteren wrote:
>>
>> For environments where the global object is represented by the Window
>> object XMLHttpRequest needs to be associated with a Document object  
>> for
>> determining the origin and base URL. The problem is that the
>> XMLHttpRequest interface object can be copied around, e.g.
>>
>>  var x = frames[0].XMLHttpRequest
>>
>> in that scenario x needs to be associated with Document object
>> associated with frames[0]. (If frames[0] is later navigated the  
>> Document
>> object would change, so it is important that this happens at this
>> point.)
>
> There is a 1:1 mapping from global object to Document object now  
> that we
> have WindowProxy objects.
>
> So you can probably just say something like:
>
>   "...the Document object associated with the Window object for  
> which the
>   XMLHttpRequest interface object was created..."
>

I am not sure this always holds.  In the case of the the transition  
from the initial ("about:blank") document to a loaded document, the  
window needs to be reused at times.  Take for instance,

w = window.open("testForProperties.html");
w.customWindowProperty = "1";
w.document.customDocumentProperty = "2";

when testForProperties.html is done loading, customWindowProperty will  
still be there, but document.customDocumentProperty will not.

>
>> To be clear, assuming a and b are distinct global objects, in
>>
>>  a.x = a.XMLHttpRequest
>>  b.x = a.x
>>
>> the XMLHttpRequest interface object in b.x has a pointer to the  
>> Document
>> object associated with a. When the XMLHttpRequest constructor is  
>> invoked
>> this pointer needs to be somehow copied to the constructed object.
>
> I think that is covered by the incantation above.
>
> -- 
> Ian Hickson               U+1047E                ) 
> \._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _ 
> \  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'-- 
> (,_..'`-.;.'
>

Received on Thursday, 30 April 2009 18:29:38 UTC