[whatwg] Document referrer and script entry point
bobbyholley at gmail.com
Tue Oct 9 06:45:18 PDT 2012
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?
More information about the whatwg