Bug 85374 - http "referer" header not properly set when using HTML5 pushState
Summary: http "referer" header not properly set when using HTML5 pushState
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.7
: P2 Major
Assignee: jochen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-02 07:42 PDT by Milovan Zogovic
Modified: 2012-05-07 02:06 PDT (History)
9 users (show)

See Also:


Attachments
Patch (5.01 KB, patch)
2012-05-04 06:07 PDT, jochen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Milovan Zogovic 2012-05-02 07:42:30 PDT
Given I am on "bar.html", and I run following javascript:

history.pushState( {}, "page1", "foo.html");
history.back(); // going back to "bar.html"
location.href = "fuffy.html";

The fuffy.html will be requested with "referer: foo.html" header, even though request is originating from "bar.html".
Comment 1 Milovan Zogovic 2012-05-02 07:43:43 PDT
If you use the browser's back button (instead history.back()), the outcome is the same.
Comment 2 Eric Seidel (no email) 2012-05-02 10:47:54 PDT
Nifty.
Comment 3 jochen 2012-05-02 14:45:27 PDT
looks like history.back() doesn't properly update FrameLoader::m_outgoingReferrer
Comment 4 jochen 2012-05-04 06:07:02 PDT
Created attachment 140201 [details]
Patch
Comment 5 WebKit Review Bot 2012-05-04 09:42:20 PDT
Comment on attachment 140201 [details]
Patch

Clearing flags on attachment: 140201

Committed r116113: <http://trac.webkit.org/changeset/116113>
Comment 6 WebKit Review Bot 2012-05-04 09:42:25 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Milovan Zogovic 2012-05-05 00:16:20 PDT
I'm total newb and this was my first bug report.. so i have no clue what is going on here :)
Is there any js snippet that I can inject to make this work for older webkit browsers? I use this feature in production and this bug makes it impossible. I'd need to manually pass referrer everywhere..
Comment 8 jochen 2012-05-05 04:45:07 PDT
I think history.replaceState(history.state, "", ""); after the popstate event triggered by history.back(); should set the correct referrer on older webkits, but I haven't tried it.
Comment 9 Milovan Zogovic 2012-05-07 02:06:14 PDT
I've tried it.. but unfortunately it doesn't work :( Any other ideas?

(In reply to comment #8)
> I think history.replaceState(history.state, "", ""); after the popstate event triggered by history.back(); should set the correct referrer on older webkits, but I haven't tried it.