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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2676163002: Refactor the forPreload flag to mean speculative preload. (Closed)
Patch Set: 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
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 7eee0125a243760fdbcb05e3f3ea4b57e8fc6096..d551b4150298ab689bf304f163f8f13a682455a2 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -571,7 +571,7 @@ void FrameFetchContext::willStartLoadingResource(
ResourceRequest& request,
Resource::Type type,
const AtomicString& fetchInitiatorName,
- bool forPreload) {
+ bool suppressLogging) {
TRACE_EVENT_ASYNC_BEGIN1(
"blink.net", "Resource", identifier, "data",
loadResourceTraceData(identifier, request.url(), request.priority()));
@@ -586,7 +586,7 @@ void FrameFetchContext::willStartLoadingResource(
} else {
m_documentLoader->applicationCacheHost()->willStartLoadingResource(request);
}
- if (!forPreload) {
+ if (!suppressLogging) {
V8DOMActivityLogger* activityLogger = nullptr;
if (fetchInitiatorName == FetchInitiatorTypeNames::xmlhttprequest) {
activityLogger = V8DOMActivityLogger::currentActivityLogger();
@@ -652,12 +652,12 @@ ResourceRequestBlockedReason FrameFetchContext::canRequest(
const ResourceRequest& resourceRequest,
const KURL& url,
const ResourceLoaderOptions& options,
- bool forPreload,
+ bool suppressReport,
FetchRequest::OriginRestriction originRestriction) const {
ResourceRequestBlockedReason blockedReason =
- canRequestInternal(type, resourceRequest, url, options, forPreload,
+ canRequestInternal(type, resourceRequest, url, options, suppressReport,
originRestriction, resourceRequest.redirectStatus());
- if (blockedReason != ResourceRequestBlockedReason::None && !forPreload) {
+ if (blockedReason != ResourceRequestBlockedReason::None && !suppressReport) {
InspectorInstrumentation::didBlockRequest(
frame(), resourceRequest, masterDocumentLoader(), options.initiatorInfo,
blockedReason);
@@ -687,7 +687,7 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(
const ResourceRequest& resourceRequest,
const KURL& url,
const ResourceLoaderOptions& options,
- bool forPreload,
+ bool suppressReport,
FetchRequest::OriginRestriction originRestriction,
ResourceRequest::RedirectStatus redirectStatus) const {
if (InspectorInstrumentation::shouldBlockRequest(frame(), resourceRequest))
@@ -699,7 +699,7 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(
if (originRestriction != FetchRequest::NoOriginRestriction &&
securityOrigin && !securityOrigin->canDisplay(url)) {
- if (!forPreload)
+ if (!suppressReport)
FrameLoader::reportLocalLoadFailed(frame(), url.elidedString());
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::requestResource URL was not "
"allowed by SecurityOrigin::canDisplay";
@@ -749,8 +749,8 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(
// Don't send CSP messages for preloads, we might never actually display those
// items.
ContentSecurityPolicy::ReportingStatus cspReporting =
- forPreload ? ContentSecurityPolicy::SuppressReport
- : ContentSecurityPolicy::SendReport;
+ suppressReport ? ContentSecurityPolicy::SuppressReport
+ : ContentSecurityPolicy::SendReport;
if (m_document) {
DCHECK(m_document->contentSecurityPolicy());
@@ -807,8 +807,8 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(
// mixed content with a CSP policy, they don't get a warning. They'll still
// get a warning in the console about CSP blocking the load.
MixedContentChecker::ReportingStatus mixedContentReporting =
- forPreload ? MixedContentChecker::SuppressReport
- : MixedContentChecker::SendReport;
+ suppressReport ? MixedContentChecker::SuppressReport
+ : MixedContentChecker::SendReport;
if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url,
mixedContentReporting))
return ResourceRequestBlockedReason::MixedContent;

Powered by Google App Engine
This is Rietveld 408576698