[XHR] What referrer to use when making requests

It's currently not specified what the 'referer' request header should
be set to when making requests using XMLHttpRequest. For example if an
XHR object is created by one document, and then passes the object to a
second document which calls xhr.open. Or if a page creates a XHR
object and then calls history.pushState some time before xhr.send is
called.

I propose that we use the "document's address" [1] of the
"XMLHttpRequest document" at the time when xhr.send is called. This is
way if an XHR object is passed between documents we are consistent
with xhr.open regarding which document address to use. And if a page
uses an XHR object to make several requests and call pushState between
these requests, we always use the most up-to-date document address
when the request actually hits the network.

[1] http://dev.w3.org/html5/spec/single-page.html#the-document-s-current-address

/ Jonas

Received on Friday, 6 July 2012 22:31:02 UTC