Commit 16139bbf authored by Charles Harrison's avatar Charles Harrison Committed by Commit Bot

[subresource_filter] Do not populate metadata for warning sites.

Currently, we populate website data metadata for sites which activate
as ENABLED. This metadata is used to trigger showing the "Ads" setting
in the settings UI, OIB, and page info.

However, we also activate as ENABLED for warning sites, and decrease
activation level downstream in the driver factory. This means that
warning sites will show up in the various settings UIs as having
intrusive ads.

This CL makes it so that warning sites do not populate the metadata. 

Bug: 779673
Change-Id: I972faf6aeda6884b584c8383918fa7a9ba966b6c
Reviewed-on: https://chromium-review.googlesource.com/744442Reviewed-by: default avatarShivani Sharma <shivanisha@chromium.org>
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512636}
parent 83b310b0
......@@ -325,3 +325,22 @@ TEST_F(SubresourceFilterTest, NotifySafeBrowsing) {
metadata));
}
}
TEST_F(SubresourceFilterTest, WarningSite_NoMetadata) {
subresource_filter::Configuration config(
subresource_filter::ActivationLevel::ENABLED,
subresource_filter::ActivationScope::ACTIVATION_LIST,
subresource_filter::ActivationList::BETTER_ADS);
scoped_configuration().ResetConfiguration(std::move(config));
const GURL url("https://example.test/");
safe_browsing::ThreatMetadata metadata;
metadata.subresource_filter_match
[safe_browsing::SubresourceFilterType::BETTER_ADS] =
safe_browsing::SubresourceFilterLevel::WARN;
auto threat_type =
safe_browsing::SBThreatType::SB_THREAT_TYPE_SUBRESOURCE_FILTER;
fake_safe_browsing_database()->AddBlacklistedUrl(url, threat_type, metadata);
SimulateNavigateAndCommit(url, main_rfh());
EXPECT_EQ(nullptr, GetSettingsManager()->GetSiteMetadata(url));
}
......@@ -223,8 +223,8 @@ void SubresourceFilterSafeBrowsingActivationThrottle::NotifyResult() {
// activation.
bool whitelisted = client_->OnPageActivationComputed(
navigation_handle(),
matched_configuration.activation_options.activation_level ==
ActivationLevel::ENABLED,
!warning && matched_configuration.activation_options.activation_level ==
ActivationLevel::ENABLED,
matched_configuration.activation_options.should_suppress_notifications);
// Only reset the activation decision reason if we would have activated.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment