Chromium Code Reviews
DescriptionSend net's ReferrerPolicy back to Blink while following redirects
//net might modify a request's referrer policy while following server
redirects that contain a Referrer-Policy header. Blink learns about the
redirects via the ResourceMsg_ReceivedRedirect IPC, and in some cases
(notably, CORS-enabled redirects), Blink chooses to tell //net not to
follow the redirect but instead kicks off a new request to follow the
redirect. (See DocumentThreadableLoader::redirectReceived().) In these
cases, Blink needs to know the referrer policy that //net assigned to
the request, based on the Referrer-Policy header that was received, so
that, for example, Blink can apply that referrer policy while following
a CORS-enabled redirect itself.
This CL changes WebURLLoaderImpl::PopulateURLRequestForRedirect() to
translate the request's net::URLRequest::ReferrerPolicy into a
WebReferrerPolicy that gets sent to Blink.
So that this translation can always be accurate, this CL also stops
using NEVER_CLEAR_REFERRER for multiple referrer policies ('origin',
'unsafe-url', and 'no-referrer') and instead always uses the
net::URLRequest::ReferrerPolicy corresponding to the actual referrer
policy for the request. That is: ORIGIN and NO_REFERRER are no longer
used only internally by URLRequest for processing Referrer-Policy
headers, but are now values that callers should use to convey a referrer
policy of 'origin' or 'no-referrer', so that the
net::URLRequest::ReferrerPolicy of a request can always be relied upon
to translate back to a WebReferrerPolicy.
BUG=628457
Committed: https://crrev.com/0f5deae9b4797dfc2ce9ec685bc877c68982621b
Cr-Commit-Position: refs/heads/master@{#424203}
Patch Set 1 #Patch Set 2 : Remove unnecessary referrer calculation in DocumentThreadableLoader #Messages
Total messages: 18 (9 generated)
|