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

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

Issue 2053693002: WIP: Move 'Upgrade-Insecure-Requests' to the browser process. Base URL: https://chromium.googlesource.com/chromium/src.git@replicate
Patch Set: Created 4 years, 6 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 9484ef33df18af1cf827b7452e145e91a9b57fa2..327bacee7a220ea4127de89d2c72268c14e31170 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -556,8 +556,12 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(Resource::Typ
// get a warning in the console about CSP blocking the load.
MixedContentChecker::ReportingStatus mixedContentReporting = forPreload ?
MixedContentChecker::SuppressReport : MixedContentChecker::SendReport;
- if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, mixedContentReporting))
- return ResourceRequestBlockedReasonMixedContent;
+ // TODO(mkwst): Skip mixed content checks when UIR is enabled. For science. (Remove this.)
+ WebInsecureRequestPolicy relevantPolicy = m_document ? m_document->getInsecureRequestPolicy() : frame()->loader().getInsecureRequestPolicy();
+ if (!(relevantPolicy & kUpgradeInsecureRequests)) {
+ if (MixedContentChecker::shouldBlockFetch(frame(), resourceRequest, url, mixedContentReporting))
+ return ResourceRequestBlockedReasonMixedContent;
+ }
// Let the client have the final say into whether or not the load should proceed.
DocumentLoader* documentLoader = masterDocumentLoader();
@@ -682,14 +686,19 @@ void FrameFetchContext::upgradeInsecureRequest(FetchRequest& fetchRequest)
// If we don't yet have an |m_document| (because we're loading an iframe, for instance), check the FrameLoader's policy.
WebInsecureRequestPolicy relevantPolicy = m_document ? m_document->getInsecureRequestPolicy() : frame()->loader().getInsecureRequestPolicy();
- SecurityContext::InsecureNavigationsSet* relevantNavigationSet = m_document ? m_document->insecureNavigationsToUpgrade() : frame()->loader().insecureNavigationsToUpgrade();
+ // printf("Setting %s policy to %d\n", url.getString().utf8().data(), relevantPolicy);
+
+ fetchRequest.mutableResourceRequest().setInsecureRequestPolicy(relevantPolicy);
+
+ /*
if (url.protocolIs("http") && relevantPolicy & kUpgradeInsecureRequests) {
// We always upgrade requests that meet any of the following criteria:
//
// 1. Are for subresources (including nested frames).
// 2. Are form submissions.
// 3. Whose hosts are contained in the document's InsecureNavigationSet.
+ SecurityContext::InsecureNavigationsSet* relevantNavigationSet = m_document ? m_document->insecureNavigationsToUpgrade() : frame()->loader().insecureNavigationsToUpgrade();
const ResourceRequest& request = fetchRequest.resourceRequest();
if (request.frameType() == WebURLRequest::FrameTypeNone
|| request.frameType() == WebURLRequest::FrameTypeNested
@@ -703,6 +712,7 @@ void FrameFetchContext::upgradeInsecureRequest(FetchRequest& fetchRequest)
fetchRequest.mutableResourceRequest().setURL(url);
}
}
+ */
}
void FrameFetchContext::addClientHintsIfNecessary(FetchRequest& fetchRequest)

Powered by Google App Engine
This is Rietveld 408576698