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

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: Implement RenderFrameObserver::OnDestruct introduced by rebase. 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 b733cd30a8677e5123d56e1de03cdc5568b81fae..82cdc89f81ca45397a01dcbf4c29edf2fb10cbc4 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>
@@ -559,14 +560,19 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(Resource::Typ
UseCounter::count(frame()->document(), UseCounter::RequestedSubresourceWithEmbeddedCredentials);
}
- // 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 = masterDocumentLoader();
+ if (documentLoader && documentLoader->subresourceFilter() && type != Resource::MainResource && type != Resource::ImportResource && !documentLoader->subresourceFilter()->allowLoad(url, resourceRequest.requestContext()))
+ return ResourceRequestBlockedReasonSubresourceFilter;
+
return ResourceRequestBlockedReasonNone;
}
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.cpp ('k') | third_party/WebKit/Source/platform/network/ResourceRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698