[whatwg] window.location aborting the parser and subsequent document.writes

Henri Sivonen hsivonen at iki.fi
Thu Jan 5 01:40:18 PST 2012


Consider https://bug98654.bugzilla.mozilla.org/attachment.cgi?id=77369
with the popup blocker disabled.

Chrome, Opera and IE open a new window/tab and load the Mozilla front
page into it. Firefox used to but doesn't anymore.

As far as I can tell, Firefox behaves according to the spec: Setting
window.location aborts the parser synchronously and the first
subsequent document.write() then implies a call to document.open(),
which aborts the navigation started by window.location.

Is there a mechanism in the spec that makes this work as in Chrome,
Opera and IE and I'm failing to read the spec right? If not, what's
the mechanism that causes Chrome and IE to load the Mozilla front page
into the newly-opened window/tab in this case?

Note that in this modified case
http://hsivonen.iki.fi/test/moz/write-after-location.html (requires a
click so that there's no need to adjust the popup blocker) the console
says "before" and "after" but not "later" in Chrome and IE.

Opera says "before" and "after" and then the opener script ends with a
security error, because write is already a different-origin call, i.e.
setting window.location has immediately made the document in the new
window different-origin.

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/


More information about the whatwg mailing list