Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: content/child/resource_dispatcher.cc

Issue 1257553002: [Proof-of-concept] PlzNavigate and Service Worker Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass navigation_provider_id Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/child/resource_dispatcher.cc
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index b57d26c4bff547f1711fed29686b716660eddb40..d3f31f5c500ca0485a8fb793960c64d13bf92104 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -756,16 +756,6 @@ scoped_ptr<ResourceHostMsg_Request> ResourceDispatcher::CreateRequest(
request->enable_upload_progress = request_info.enable_upload_progress;
request->do_not_prompt_for_login = request_info.do_not_prompt_for_login;
- if ((request_info.referrer.policy == blink::WebReferrerPolicyDefault ||
- request_info.referrer.policy ==
- blink::WebReferrerPolicyNoReferrerWhenDowngrade) &&
- request_info.referrer.url.SchemeIsCryptographic() &&
- !request_info.url.SchemeIsCryptographic()) {
- LOG(FATAL) << "Trying to send secure referrer for insecure request "
- << "without an appropriate referrer policy.\n"
- << "URL = " << request_info.url << "\n"
- << "Referrer = " << request_info.referrer.url;
- }
const RequestExtraData kEmptyData;
const RequestExtraData* extra_data;
@@ -773,6 +763,20 @@ scoped_ptr<ResourceHostMsg_Request> ResourceDispatcher::CreateRequest(
extra_data = static_cast<RequestExtraData*>(request_info.extra_data);
else
extra_data = &kEmptyData;
+
+ if (extra_data->navigation_provider_id() == kInvalidServiceWorkerProviderId) {
+ if ((request_info.referrer.policy == blink::WebReferrerPolicyDefault ||
michaeln 2015/07/30 01:35:08 Would it make sense to explicitly use a different
nasko 2015/08/07 17:51:11 What is the rationale for that? There should be no
+ request_info.referrer.policy ==
+ blink::WebReferrerPolicyNoReferrerWhenDowngrade) &&
+ request_info.referrer.url.SchemeIsCryptographic() &&
+ !request_info.url.SchemeIsCryptographic()) {
+ LOG(FATAL) << "Trying to send secure referrer for insecure request "
+ << "without an appropriate referrer policy.\n"
+ << "URL = " << request_info.url << "\n"
+ << "Referrer = " << request_info.referrer.url;
+ }
+ }
+
request->visiblity_state = extra_data->visibility_state();
request->render_frame_id = extra_data->render_frame_id();
request->is_main_frame = extra_data->is_main_frame();
@@ -791,6 +795,10 @@ scoped_ptr<ResourceHostMsg_Request> ResourceDispatcher::CreateRequest(
request->request_body = request_body;
if (frame_origin)
*frame_origin = extra_data->frame_origin();
+
+ // PlzNavigate: Hack to avoid the referrer check failure in browser process.
nasko 2015/08/07 17:51:11 What is this failure?
+ if (extra_data->navigation_provider_id() != kInvalidServiceWorkerProviderId)
+ request->referrer = GURL();
return request.Pass();
}

Powered by Google App Engine
This is Rietveld 408576698