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

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

Issue 2022783002: Skeleton of the Safe Browsing Subresource Filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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 97c1d6760803b4efdaead637c65470ba8ee29dae..95b77d28bad78fd669aaf85fb7d93384041297f5 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -70,6 +70,7 @@
#include "platform/weborigin/SchemeRegistry.h"
#include "platform/weborigin/SecurityPolicy.h"
#include "public/platform/WebCachePolicy.h"
+#include "public/platform/WebDocumentSubresourceFilter.h"
#include "public/platform/WebFrameScheduler.h"
#include <algorithm>
@@ -572,14 +573,19 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(Resource::Typ
UseCounter::count(frame()->document(), UseCounter::ResourceLoadedAfterRedirectWithCSP);
}
- // Last of all, check for mixed content. We do this last so that when
- // folks block 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.
+ // Check for mixed content. We do this second-to-last so that when folks block
+ // 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;
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 = effectiveDocumentLoader();
+ if (documentLoader && documentLoader->subresourceFilter() && type != Resource::MainResource && type != Resource::ImportResource && !documentLoader->subresourceFilter()->allowLoad(url, resourceRequest.requestContext()))
+ return ResourceRequestBlockedReasonSubresourceFilter;
+
return ResourceRequestBlockedReasonNone;
}

Powered by Google App Engine
This is Rietveld 408576698