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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2748463002: Split header modification out of willSendRequest
Patch Set: bug fix Created 3 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: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index cd48a31c02413e147a276c978be6ce4912ae7be6..0500d2f243862b3fe149cd65c316b060c6ec1379 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -505,8 +505,6 @@ ResourceFetcher::PrepareRequestResult ResourceFetcher::prepareRequest(
(request.isSpeculativePreload()
? FetchContext::V8ActivityLoggingPolicy::SuppressLogging
: FetchContext::V8ActivityLoggingPolicy::Log));
- if (!request.url().isValid())
- return Abort;
// Resource requests from suborigins should not be intercepted by the service
// worker of the physical origin. This has the effect that, for now,
@@ -520,6 +518,11 @@ ResourceFetcher::PrepareRequestResult ResourceFetcher::prepareRequest(
resourceRequest.setAllowStoredCredentials(
request.options().allowCredentials == AllowStoredCredentials);
+ context().prepareRequest(identifier, resourceRequest);
+
+ if (!request.url().isValid())
+ return Abort;
+
return Continue;
}
@@ -1249,15 +1252,9 @@ bool ResourceFetcher::startLoad(Resource* resource) {
return false;
}
- ResourceRequest request(resource->resourceRequest());
- context().dispatchWillSendRequest(resource->identifier(), request,
- ResourceResponse(),
- resource->options().initiatorInfo);
-
- // TODO(shaochuan): Saving modified ResourceRequest back to |resource|, remove
- // once dispatchWillSendRequest() takes const ResourceRequest.
- // crbug.com/632580
- resource->setResourceRequest(request);
+ context().dispatchWillSendRequest(
+ resource->identifier(), resource->resourceRequest(), ResourceResponse(),
+ resource->options().initiatorInfo);
ResourceLoader* loader = ResourceLoader::create(this, resource);
if (resource->shouldBlockLoadEvent())
@@ -1268,8 +1265,8 @@ bool ResourceFetcher::startLoad(Resource* resource) {
storePerformanceTimingInitiatorInformation(resource);
resource->setFetcherSecurityOrigin(context().getSecurityOrigin());
- loader->activateCacheAwareLoadingIfNeeded(request);
- loader->start(request);
+ loader->activateCacheAwareLoadingIfNeeded(resource->resourceRequest());
+ loader->start(resource->resourceRequest());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698