W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2012

[whatwg] Document referrer and script entry point

From: Bobby Holley <bobbyholley@gmail.com>
Date: Tue, 9 Oct 2012 15:45:18 +0200
Message-ID: <CAKBxTcL11WdqUueoMuX4eYZ7h1EE3wbEs5=zxtNQU7zZQPscKA@mail.gmail.com>
To: whatwg@lists.whatwg.org, public-script-coord@w3.org
Cc: Boris Zbarsky <bzbarsky@mit.edu>
The spec says the following about Document.referrer:

The referrer attribute must return either the address of the active
document of the source browsing context at the time the navigation was
started (that is, the page which navigated the browsing context to the
current document) (3.1.3).

This implies that if document |a| calls into a same-origin function
running in the scope of document |b|, which navigates an iframe to
|c|, c.referrer should point to |b|.

The alternate implementation would be to let c.referrer equal the
script entry point, which would be |a|.

A cursory analysis indicates that Gecko and WebKit implement spec
behavior. Opera and IE implement the alternate behavior. My testcase
is here: http://people.mozilla.org/~bholley/testcases/a-calls-b-navigates-c/a.html

I'd like to change Gecko to implement the alternate behavior - that is
to say, making document.referrer refer to the script entry point at
the time of navigation. We already track the script-entry point
per-spec, so finding that is easy. In contrast, finding the
immediately-calling document requires some nasty JS introspection that
I'd like to get rid of.

However, that would leave WebKit as the only engine implementing the
spec behavior. Any WebKit folks want to chime in on this issue? Ian,
how do you feel about this spec-wise?

Cheers,
bholley
Received on Tuesday, 9 October 2012 13:46:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT