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; |
} |