Commit 25cd5f17 authored by jochen@chromium.org's avatar jochen@chromium.org

Fix referrer policy passing during redirects

We a redirect commits, we should take the referrer policy from the
request we actually send and not from the one we intended to send.

Also, when the renderer tells the browser about a new navigation, always
update the referrer together with the URL

Depends on https://codereview.chromium.org/126753002/ in blink

BUG=331941
R=nasko@chromium.org
TEST=browser_tests:ReferrerPolicyTest.*

Review URL: https://codereview.chromium.org/128173002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244138 0039d316-1c4b-4281-b951-d872f2087c98
parent c4086a76
......@@ -308,6 +308,7 @@ void NavigationControllerImpl::ReloadInternal(bool check_for_repost,
// POST wasn't involved; the latter case avoids issues with sending data to
// the wrong page.
entry->SetURL(entry->GetOriginalRequestURL());
entry->SetReferrer(Referrer());
}
if (g_check_for_repost && check_for_repost &&
......@@ -1056,6 +1057,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
// The URL may have changed due to redirects.
entry->SetURL(params.url);
entry->SetReferrer(params.referrer);
if (entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(entry, params.url);
......@@ -1109,6 +1111,7 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
if (existing_entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(existing_entry, params.url);
existing_entry->SetURL(params.url);
existing_entry->SetReferrer(params.referrer);
// The page may have been requested with a different HTTP method.
existing_entry->SetHasPostData(params.is_post);
......
......@@ -1176,7 +1176,6 @@ void RenderFrameImpl::willSendRequest(
blink::WebReferrerPolicy referrer_policy;
if (internal_data->is_referrer_policy_set()) {
referrer_policy = internal_data->referrer_policy();
internal_data->clear_referrer_policy();
} else {
referrer_policy = frame->document().referrerPolicy();
}
......
......@@ -1963,9 +1963,7 @@ void RenderViewImpl::UpdateURL(WebFrame* frame) {
params.transition = static_cast<PageTransition>(
params.transition | PAGE_TRANSITION_CLIENT_REDIRECT);
} else {
// Bug 654101: the referrer will be empty on https->http transitions. It
// would be nice if we could get the real referrer from somewhere.
params.referrer = GetReferrerFromRequest(frame, original_request);
params.referrer = GetReferrerFromRequest(frame, ds->request());
}
base::string16 method = request.httpMethod();
......@@ -3587,6 +3585,7 @@ void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame,
internal_data->set_must_reset_scroll_and_scale_state(false);
}
internal_data->set_use_error_page(false);
internal_data->clear_referrer_policy();
if (is_new_navigation) {
// When we perform a new navigation, we need to update the last committed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment