Re: [webidl] XMLHttpRequest interface object

On Fri, 5 Jun 2009, Boris Zbarsky wrote:
> Ian Hickson wrote:
> > On Thu, 30 Apr 2009, Boris Zbarsky wrote:
> > > Sam Weinig wrote:
> > > > 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.
> > > Yep.  In this case, that's exactly what Gecko does: puts the new document
> > > in
> > > the old inner window.
> > 
> > Is this the case only when the new document is from the same origin? That
> > is, when the new document has a different origin than the about:blank
> > document, does a new Window get created instead of reusing the old one? Or
> > do the properties get cleaned out somehow?
> 
> That's correct.  The precise set of conditions that must be met for web
> content for the inner window to be reused is:
> 
> 1) It already has a document.
> 2) This document is its "initial document".  A document is flagged
>    as an "initial document" in two cases:
>    i) It's present in the window after the window has been opened
>       but before window.open() has returned (typically due to the
>       browser UI forcing its creation).
>    ii) It's created because someone asks for a document on a
>        window that doesn't have one yet.
>    I don't recall why (i) is needed at this point, but I could
>    probably look it up if necessary.  In any case, it would be
>    some artifact of the exact order of document/window setup
>    in Gecko.  There is an assertion in the code that the URI
>    of any "initial document" is about:blank.
> 3) The origin of the old document is the same as that of the
>    new document.

I've attempted to specify this exception to the 1:1 mapping of Windows and 
Documents.

   http://www.whatwg.org/specs/web-apps/current-work/#create-a-document-object

(r3351)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 1 July 2009 22:10:18 UTC