| Index: components/subresource_filter/content/renderer/document_subresource_filter.cc
|
| diff --git a/components/subresource_filter/content/renderer/document_subresource_filter.cc b/components/subresource_filter/content/renderer/document_subresource_filter.cc
|
| index 42da60858d74c8c8d0b62f51e6e02f20e2161f02..895c3cc8a173ed4e65aa212319ca9e2a68cb77d3 100644
|
| --- a/components/subresource_filter/content/renderer/document_subresource_filter.cc
|
| +++ b/components/subresource_filter/content/renderer/document_subresource_filter.cc
|
| @@ -127,10 +127,11 @@ DocumentSubresourceFilter::DocumentSubresourceFilter(
|
|
|
| DocumentSubresourceFilter::~DocumentSubresourceFilter() = default;
|
|
|
| -bool DocumentSubresourceFilter::allowLoad(
|
| +blink::WebDocumentSubresourceFilter::LoadPolicy
|
| +DocumentSubresourceFilter::getLoadPolicy(
|
| const blink::WebURL& resourceUrl,
|
| blink::WebURLRequest::RequestContext request_context) {
|
| - TRACE_EVENT1("loader", "DocumentSubresourceFilter::allowLoad", "url",
|
| + TRACE_EVENT1("loader", "DocumentSubresourceFilter::getLoadPolicy", "url",
|
| resourceUrl.string().utf8());
|
|
|
| auto wall_duration_timer = ScopedTimers::StartIf(
|
| @@ -150,10 +151,10 @@ bool DocumentSubresourceFilter::allowLoad(
|
| ++statistics_.num_loads_total;
|
|
|
| if (filtering_disabled_for_document_)
|
| - return true;
|
| + return Allow;
|
|
|
| if (resourceUrl.protocolIs(url::kDataScheme))
|
| - return true;
|
| + return Allow;
|
|
|
| ++statistics_.num_loads_evaluated;
|
| DCHECK(document_origin_);
|
| @@ -162,16 +163,21 @@ bool DocumentSubresourceFilter::allowLoad(
|
| generic_blocking_rules_disabled_)) {
|
| ++statistics_.num_loads_matching_rules;
|
| if (activation_level_ == ActivationLevel::ENABLED) {
|
| - if (!first_disallowed_load_callback_.is_null()) {
|
| - DCHECK_EQ(statistics_.num_loads_disallowed, 0);
|
| - first_disallowed_load_callback_.Run();
|
| - first_disallowed_load_callback_.Reset();
|
| - }
|
| ++statistics_.num_loads_disallowed;
|
| - return false;
|
| + return Filter;
|
| + } else if (activation_level_ == ActivationLevel::DRYRUN) {
|
| + return AllowWouldFilter;
|
| }
|
| }
|
| - return true;
|
| + return Allow;
|
| +}
|
| +
|
| +void DocumentSubresourceFilter::reportFilteredLoad() {
|
| + if (first_disallowed_load_callback_.is_null())
|
| + return;
|
| +
|
| + first_disallowed_load_callback_.Run();
|
| + first_disallowed_load_callback_.Reset();
|
| }
|
|
|
| } // namespace subresource_filter
|
|
|