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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2184823006: Call FetchContext::dispatchWillSendRequest() only if an actual load is started (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor Created 4 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/network/resources/font-face.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index dd07563a5e11cf9cc61916fcb27957720a7dd178..cef4089c2c796c7777cbe91d58256c1e4ac0e122 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -465,8 +465,7 @@ Resource* ResourceFetcher::requestResource(FetchRequest& request, const Resource
updateMemoryCacheStats(resource, policy, request, factory, isStaticData);
- if (policy != Use)
- willSendRequest(identifier, request.mutableResourceRequest(), ResourceResponse(), request.options());
+ request.mutableResourceRequest().setAllowStoredCredentials(request.options().allowCredentials == AllowStoredCredentials);
switch (policy) {
case Reload:
@@ -991,6 +990,9 @@ bool ResourceFetcher::startLoad(Resource* resource)
return false;
}
+ ResourceRequest request(resource->resourceRequest());
Nate Chapin 2016/07/28 17:20:37 It'd be nice if we could eventually return to a si
hiroshige 2016/07/29 05:59:24 Agree. Filed crbug.com/632580. Splitting willSend
+ willSendRequest(resource->identifier(), request, ResourceResponse(), resource->options());
+
ResourceLoader* loader = ResourceLoader::create(this, resource);
if (resource->shouldBlockLoadEvent())
m_loaders.add(loader);
@@ -999,7 +1001,7 @@ bool ResourceFetcher::startLoad(Resource* resource)
storeResourceTimingInitiatorInformation(resource);
resource->setFetcherSecurityOrigin(context().getSecurityOrigin());
- loader->start(resource->resourceRequest(), context().loadingTaskRunner(), context().defersLoading());
+ loader->start(request, context().loadingTaskRunner(), context().defersLoading());
return true;
}
@@ -1069,13 +1071,13 @@ bool ResourceFetcher::willFollowRedirect(Resource* resource, ResourceRequest& ne
bool crossOrigin = !redirectedSecurityOrigin->isSameSchemeHostPort(originalSecurityOrigin.get());
it->value->addRedirect(redirectResponse, encodedDataLength, crossOrigin);
}
+ newRequest.setAllowStoredCredentials(resource->options().allowCredentials == AllowStoredCredentials);
willSendRequest(resource->identifier(), newRequest, redirectResponse, resource->options());
return true;
}
void ResourceFetcher::willSendRequest(unsigned long identifier, ResourceRequest& newRequest, const ResourceResponse& redirectResponse, const ResourceLoaderOptions& options)
{
- newRequest.setAllowStoredCredentials(options.allowCredentials == AllowStoredCredentials);
context().dispatchWillSendRequest(identifier, newRequest, redirectResponse, options.initiatorInfo);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/network/resources/font-face.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698