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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 1847383003: CREDENTIAL: Rework the integration with Fetch (2/2) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-serialized
Patch Set: unittest Created 4 years, 9 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/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index 2b9d783dc2f095bfb18439cbf41a802a624a32c9..414b8d9ec5434b7425cb896017be4da41e91f14a 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -539,8 +539,22 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
request_info.report_raw_headers = request.reportRawHeaders();
request_info.loading_web_task_runner.reset(web_task_runner_->clone());
- scoped_refptr<ResourceRequestBody> request_body =
- GetRequestBodyForWebURLRequest(request).get();
+ // If the request has an attached credential, then use it as the
+ // |request_body| and ensure that the service worker will be presented
+ // with a Request whose body is empty.
+ //
+ // This doesn't line up with the way the spec is written (see
+ // https://w3c.github.io/webappsec-credential-management/#monkey-patching)
+ // but it has the advantage of actually working with our architechture.
+ scoped_refptr<ResourceRequestBody> request_body;
+ if (!request.attachedCredentialBody().isNull()) {
+ request_body =
+ GetRequestBodyForWebURLRequest(request, CREDENTIAL_BODY).get();
+ request_info.empty_body_in_service_worker = true;
+ } else {
+ request_body = GetRequestBodyForWebURLRequest(request, HTTP_BODY).get();
+ request_info.empty_body_in_service_worker = false;
+ }
// PlzNavigate: during navigation, the renderer should request a stream which
// contains the body of the response. The network request has already been
@@ -553,8 +567,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
}
if (sync_load_response) {
- resource_dispatcher_->StartSync(
- request_info, request_body.get(), sync_load_response);
+ resource_dispatcher_->StartSync(request_info, request_body.get(),
+ sync_load_response);
return;
}

Powered by Google App Engine
This is Rietveld 408576698