Index: chrome/browser/subresource_filter/chrome_subresource_filter_client.cc |
diff --git a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc |
index 92d4e7d3b4159c8bf58505def0ba0df62d72baaa..6c1a9d1fe4f59de1b3188d23ac429add34981628 100644 |
--- a/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc |
+++ b/chrome/browser/subresource_filter/chrome_subresource_filter_client.cc |
@@ -121,9 +121,18 @@ bool ChromeSubresourceFilterClient::OnPageActivationComputed( |
bool activated) { |
const GURL& url(navigation_handle->GetURL()); |
DCHECK(navigation_handle->IsInMainFrame()); |
+ |
+ // If the site is no longer activated, clear the metadata. This is to maintain |
+ // the invariant that metadata implies activated. |
+ if (!activated && url.SchemeIsHTTPOrHTTPS()) |
+ settings_manager_->ClearSiteMetadata(url); |
+ |
// Return whether the activation should be whitelisted. |
return whitelisted_hosts_.count(url.host()) || |
settings_manager_->GetSitePermission(url) == CONTENT_SETTING_BLOCK; |
+ // TODO(csharrison): Consider setting the metadata to an empty dict here if |
+ // the site is activated and not whitelisted. Need to be careful about various |
+ // edge cases like |should_suppress_notification| and DRYRUN activation. |
} |
void ChromeSubresourceFilterClient::WhitelistByContentSettings( |