W3C home > Mailing lists > Public > public-webapi@w3.org > March 2006

ACTION-98: what does XMLHttpRequest.open resolve relative uris against

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 20 Mar 2006 00:38:09 -0800
Message-ID: <441E69F1.2030709@sicking.cc>
To: Web APIs WG <public-webapi@w3.org>
If the URI given as the second parameter to the open call of 
XMLHttpRequest the implementation needs to resolve that uri against some 
absolute uri.

In the simplest case there is only one document involved. In this case 
mozilla resolves the uri against the baseURI DOM property of that 
document. (This property is affected by among other things any <base> 
tags in that document).

A more complicated case is when code in windowA calls code in windowB 
and either of them sets up or creates an XMLHttpRequest.

In mozilla we use document of the context that is at the *bottom* of the 
callstack (assuming the stack grows up) at the time open is called. I.e. 
if an onload handler in windowA calls a function in windowB and that 
function uses an XMLHttpRequest, we will use windowA.document.baseURI to 
resolve the uri.

I have attached a zipped testcase that tests a variety of ways to call 
back and forth. In mozilla all but Test6 shows 'outer'. (Yes, i'm aware 
that Test6 runs first).

I think this is very confusing, to say the least. I would argue that we 
should use the window at the *top* of the callstack when open is called. 
Thus only Test3 and Test4 should show 'outer'.

/ Jonas


Received on Monday, 20 March 2006 08:38:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:54 GMT