Skip to content

Commit

Permalink
Merge pull request #16527 from brave/fix-adblock-component-uninstall
Browse files Browse the repository at this point in the history
Uninstall components for removed regional lists
  • Loading branch information
antonok-edm authored Jan 4, 2023
2 parents f0bc5cc + 5cf6ce2 commit 2263fda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ AdBlockComponentFiltersProvider::AdBlockComponentFiltersProvider(
catalog_entry.base64_public_key,
catalog_entry.title) {}

AdBlockComponentFiltersProvider::~AdBlockComponentFiltersProvider() {
AdBlockComponentFiltersProvider::~AdBlockComponentFiltersProvider() {}

void AdBlockComponentFiltersProvider::UnregisterComponent() {
// Can be nullptr in unit tests
if (component_updater_service_) {
component_updater_service_->UnregisterComponent(component_id_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class AdBlockComponentFiltersProvider : public AdBlockFiltersProvider {
base::OnceCallback<void(bool deserialize,
const DATFileDataBuffer& dat_buf)>) override;

// Remove the component. This will force it to be redownloaded next time it
// is registered.
void UnregisterComponent();

private:
friend class ::AdBlockServiceTest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ void AdBlockRegionalServiceManager::EnableFilterList(const std::string& uuid,
DCHECK(it != regional_filters_providers_.end());
AdBlockFiltersProviderManager::GetInstance()->RemoveProvider(
it->second.get());
it->second->UnregisterComponent();
regional_filters_providers_.erase(it);
}

Expand Down

0 comments on commit 2263fda

Please sign in to comment.