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

Question on what "the script's context" means

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Fri, 21 Apr 2006 17:41:52 -0500
Message-ID: <44495FB0.6010307@mit.edu>
To: "Web APIs WG (public)" <public-webapi@w3.org>

The documentation for the |uri| argument to XMLHttpRequest.open says:

   A URI, which MUST be resolved to an absolute URI using the script's context
   window.location.href value as base if available.

What is "the script's context" exactly?  It's not defined in the spec.  Assuming 
we limit ourselves to ECMAScript (outside of which there is no "script"), 
consider the following situation:

Two windows, A and B, have the same origin but different URIs (say different 
directories on the same server).

Window A has the following code:

   var xhr;
   function create() {
     xhr = new XMLHttpRequest();

   function callOpen(url) {
     xhr.open("GET", url, true);

Window B has the following code:

   var A;
   // Get reference to Window A into |A|.

   function runTest() {

In this situation, which URI should be used as the base URI?  Does it matter 
whether runTest() was called from code in some other window C (possibly C == A)?

Received on Friday, 21 April 2006 22:41:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:21 UTC