- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 05 Jun 2009 12:04:00 -0400
- To: Ian Hickson <ian@hixie.ch>
- CC: Sam Weinig <weinig@apple.com>, WebApps WG <public-webapps@w3.org>
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.
-Boris
Received on Friday, 5 June 2009 16:04:44 UTC