Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/filterListener.js

Issue 29946572: Issue 7094 - Keep subscription filters by text only (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase Created Feb. 16, 2019, 3:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/filterStorage.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterListener.js
===================================================================
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -27,17 +27,17 @@
const {filterStorage} = require("./filterStorage");
const {filterNotifier} = require("./filterNotifier");
const {ElemHide} = require("./elemHide");
const {ElemHideEmulation} = require("./elemHideEmulation");
const {ElemHideExceptions} = require("./elemHideExceptions");
const {Snippets} = require("./snippets");
const {defaultMatcher} = require("./matcher");
-const {ActiveFilter, RegExpFilter,
+const {Filter, ActiveFilter, RegExpFilter,
ElemHideBase, ElemHideFilter, ElemHideEmulationFilter,
SnippetFilter} = require("./filterClasses");
const {SpecialSubscription} = require("./subscriptionClasses");
const {Prefs} = require("prefs");
/**
* Increases on filter changes, filters will be saved if it exceeds 1.
* @type {number}
@@ -218,63 +218,63 @@
}
function onSubscriptionAdded(subscription)
{
FilterListener.setDirty(1);
if (!subscription.disabled)
{
- for (let filter of subscription.filters())
- addFilter(filter);
+ for (let text of subscription.filterText())
+ addFilter(Filter.fromText(text));
}
}
function onSubscriptionRemoved(subscription)
{
FilterListener.setDirty(1);
if (!subscription.disabled)
{
- for (let filter of subscription.filters())
- removeFilter(filter);
+ for (let text of subscription.filterText())
+ removeFilter(Filter.fromText(text));
}
}
function onSubscriptionDisabled(subscription, newValue)
{
FilterListener.setDirty(1);
if (filterStorage.knownSubscriptions.has(subscription.url))
{
if (newValue == false)
{
- for (let filter of subscription.filters())
- addFilter(filter);
+ for (let text of subscription.filterText())
+ addFilter(Filter.fromText(text));
}
else
{
- for (let filter of subscription.filters())
- removeFilter(filter);
+ for (let text of subscription.filterText())
+ removeFilter(Filter.fromText(text));
}
}
}
-function onSubscriptionUpdated(subscription, oldFilters)
+function onSubscriptionUpdated(subscription, oldFilterText)
{
FilterListener.setDirty(1);
if (!subscription.disabled &&
filterStorage.knownSubscriptions.has(subscription.url))
{
- for (let filter of oldFilters)
- removeFilter(filter);
+ for (let text of oldFilterText)
+ removeFilter(Filter.fromText(text));
- for (let filter of subscription.filters())
- addFilter(filter);
+ for (let text of subscription.filterText())
+ addFilter(Filter.fromText(text));
}
}
function onFilterHitCount(filter, newValue)
{
if (newValue == 0)
FilterListener.setDirty(0);
else
@@ -326,18 +326,18 @@
ElemHideEmulation.clear();
ElemHideExceptions.clear();
Snippets.clear();
for (let subscription of filterStorage.subscriptions())
{
if (!subscription.disabled)
{
- for (let filter of subscription.filters())
- addFilter(filter);
+ for (let text of subscription.filterText())
+ addFilter(Filter.fromText(text));
}
}
}
function onSave()
{
isDirty = 0;
}
« no previous file with comments | « no previous file | lib/filterStorage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld