- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 14 Dec 2012 13:26:17 -0500
- To: Anne van Kesteren <annevk@annevk.nl>
- CC: Jungkee Song <jungkee.song@samsung.com>, public-webapps@w3.org
On 12/14/12 12:54 PM, Anne van Kesteren wrote: > On Fri, Dec 14, 2012 at 6:40 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: >> Which other case? The document.open() one? In that case, there is no >> problem with the document per se; the only question is whether the XHR has >> an associated document object at all in that case... and per spec not >> having one does NOT cause open() to throw. > > So you're saying that while there is an old Window object that the > XMLHttpRequest interface object is on, it no longer has an associated > Document object? Well, more precisely the Document that used to be associated with it is now associated with a different Window. Whether it's also still associated with the old window is not obvious from the specs at first glance... > I thought there was a 1:1 mapping. There isn't, in some cases. document.open creates a new Window but keeps the same Document. Doing a same-origin pageload in a navigation context that was showing the initial about:blank creates a new Document but keeps the same Window. Insert obligatory quote about sense of logic and doors. ;) > That would mean > http://xhr.spec.whatwg.org/#dom-xmlhttprequest is bogus. If a Window > object potentially has a Document object given this edge case I > suppose what I would propose is that when it does not have one, XHR's > document is set to null, and we throw for xhr.open(). It would actually be easier to throw from the constructor, from an implementation point of view... But we could make either one work, I guess. -Boris
Received on Friday, 14 December 2012 18:26:49 UTC