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