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

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

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: Renamed ReportingPolicy and moved comments Created 3 years, 10 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/Source/platform/loader/fetch/ResourceFetcher.cpp ('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/platform/loader/fetch/ResourceLoader.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
index 510afc9cc5a188453f7b19aeebbbefb60964adc7..488ee424fd9a77e93b1c0cb835535e6a79240be4 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
@@ -172,7 +172,11 @@ bool ResourceLoader::willFollowRedirect(
if (!isManualRedirectFetchRequest(m_resource->resourceRequest())) {
ResourceRequestBlockedReason blockedReason = context().canRequest(
m_resource->getType(), newRequest, newRequest.url(),
- m_resource->options(), m_resource->isUnusedPreload(),
+ m_resource->options(),
+ /* Don't send security violation reports for unused preloads */
+ (m_resource->isUnusedPreload()
+ ? FetchContext::SecurityViolationReportingPolicy::SuppressReporting
+ : FetchContext::SecurityViolationReportingPolicy::Report),
FetchRequest::UseDefaultOriginRestrictionForType);
if (blockedReason != ResourceRequestBlockedReason::None) {
cancelForRedirectAccessCheckError(newRequest.url(), blockedReason);
@@ -258,11 +262,15 @@ ResourceRequestBlockedReason ResourceLoader::canAccessResponse(
Resource* resource,
const ResourceResponse& response) const {
// Redirects can change the response URL different from one of request.
- bool forPreload = resource->isUnusedPreload();
- ResourceRequestBlockedReason blockedReason =
- context().canRequest(resource->getType(), resource->resourceRequest(),
- response.url(), resource->options(), forPreload,
- FetchRequest::UseDefaultOriginRestrictionForType);
+ bool unusedPreload = resource->isUnusedPreload();
+ ResourceRequestBlockedReason blockedReason = context().canRequest(
+ resource->getType(), resource->resourceRequest(), response.url(),
+ resource->options(),
+ /* Don't send security violation reports for unused preloads */
+ (unusedPreload
+ ? FetchContext::SecurityViolationReportingPolicy::SuppressReporting
+ : FetchContext::SecurityViolationReportingPolicy::Report),
+ FetchRequest::UseDefaultOriginRestrictionForType);
if (blockedReason != ResourceRequestBlockedReason::None)
return blockedReason;
@@ -286,7 +294,7 @@ ResourceRequestBlockedReason ResourceLoader::canAccessResponse(
sourceOrigin);
if (corsStatus != CrossOriginAccessControl::kAccessAllowed) {
resource->setCORSFailed();
- if (!forPreload) {
+ if (!unusedPreload) {
String resourceType = Resource::resourceTypeToString(
resource->getType(), resource->options().initiatorInfo.name);
StringBuilder builder;
« no previous file with comments | « third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698