Closed
Bug 968861
Opened 12 years ago
Closed 2 years ago
No referer header when the page is reloaded after modifying window.location.hash or history.pushState
Categories
(Core :: DOM: Navigation, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jan, Unassigned)
References
Details
(Whiteboard: needs spec check)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
Steps to reproduce:
1. open e.g. http://www.w3schools.com
2. open firebug, click net tab
3. click e.g. Learn HTML (http://www.w3schools.com/html/default.asp)
4. see the first request (default.asp) -> Referer: http://www.w3schools.com/
5. reload the page
6. see the first request (default.asp) -> Referer: http://www.w3schools.com/
7. switch to console tab of the firebug window
8. run window.location.hash = 'sc=1';
9. reload the page
10. see the first request (defualt.asp) -> no referer header
Actual results:
No referer header is found in the request http header if the history has been changed by window.location.hash or by history.pushState and the page was then reloaded.
Expected results:
The same referer header as before the script was run should be present.
Updated•12 years ago
|
Component: Untriaged → General
Product: Firefox → Core
Summary: No referer header after the page is reloaded → No referer header when the page is reloaded after modifying window.location.hash or history.pushState
![]() |
||
Comment 1•12 years ago
|
||
Needs spec check to see what happens here. I'm a bit surprised we resend the old referrer on reload..
Component: General → Document Navigation
Whiteboard: needs spec check
![]() |
||
Comment 2•12 years ago
|
||
But chances are, we don't copy over the referrer URI to the new SHEntry. Again, the question is what the spec says here.
Comment 3•11 years ago
|
||
The spec is
http://www.w3.org/html/wg/drafts/html/master/dom.html#dom-document-referrer
http://www.w3.org/html/wg/drafts/html/master/dom.html#the-document%27s-referrer
Neither provides sufficient info. However, this seems a valid bug to me.
> But chances are, we don't copy over the referrer URI to the new SHEntry.
That's right. When LoadURI() is called and the request is simple hash change, docshell go into the short-circuited root so as to skip network things. In that case, the request channel is nullptr.
http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsDocShell.cpp?force=1#9365
> 9365 OnNewURI(aURI, nullptr, owner, mLoadType, true, true, true);
AddToSessionHistory() will tries to set the referrer from the (null) channel, then it clears the referrer.
http://mxr.mozilla.org/mozilla-central/source/docshell/base/nsDocShell.cpp#11086
> 11086 entry->SetReferrerURI(referrerURI);
![]() |
||
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
![]() |
||
Comment 5•5 years ago
|
||
Peter, Anny, if you're redesigning session history anyway...
![]() |
||
Comment 6•5 years ago
|
||
In particular, nsDocShell::AddToSessionHistory
only puts referrer info on the new entry if aChannel is not null. But nsDocShell::UpdateURLAndHistory
passes null for the channel. So presumably it should copy the referrer state manually. That's for the pushState
case. The location.hash
case would need something similar.
Updated•5 years ago
|
Updated•3 years ago
|
Severity: normal → S3
Comment 7•2 years ago
|
||
This has been fixed in bug 761152 and bug 1750706
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Updated•9 months ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•