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

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

Issue 2677223002: Distinguish between subresource filtering and dryrun matching. (Closed)
Patch Set: rebase Created 3 years, 10 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 274f41e84f9865614af681f134dbd71ef2dc139b..607cefdf4231681b31a6de9f5e17c63050659f82 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -819,10 +819,26 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(
// proceed.
DocumentLoader* documentLoader = masterDocumentLoader();
if (documentLoader && documentLoader->subresourceFilter() &&
- type != Resource::MainResource && type != Resource::ImportResource &&
- !documentLoader->subresourceFilter()->allowLoad(
- url, resourceRequest.requestContext()))
- return ResourceRequestBlockedReason::SubresourceFilter;
+ type != Resource::MainResource && type != Resource::ImportResource) {
+ WebDocumentSubresourceFilter::LoadPolicy loadPolicy =
+ documentLoader->subresourceFilter()->getLoadPolicy(
+ url, resourceRequest.requestContext());
+ if (reportingPolicy == SecurityViolationReportingPolicy::Report) {
+ switch (loadPolicy) {
+ case WebDocumentSubresourceFilter::Allow:
+ break;
+ case WebDocumentSubresourceFilter::Disallow:
+ documentLoader->subresourceFilter()->reportDisallowedLoad();
+ // fall through
+ case WebDocumentSubresourceFilter::WouldDisallow:
+ documentLoader->didObserveLoadingBehavior(
+ WebLoadingBehaviorSubresourceFilterMatch);
+ break;
+ }
+ }
+ if (loadPolicy == WebDocumentSubresourceFilter::Disallow)
+ return ResourceRequestBlockedReason::SubresourceFilter;
+ }
return ResourceRequestBlockedReason::None;
}

Powered by Google App Engine
This is Rietveld 408576698