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

Unified Diff: lib/filterListener.js

Issue 29361668: Issue 4394 - Create a filter class for element hiding emulation filters (Closed) Base URL: https://bitbucket.org/fhd/adblockpluscore
Patch Set: Address Wladimir's comments Created Nov. 21, 2016, 2:34 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
Index: lib/filterListener.js
===================================================================
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -22,19 +22,19 @@
"use strict";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
let {FilterStorage} = require("filterStorage");
let {FilterNotifier} = require("filterNotifier");
let {ElemHide} = require("elemHide");
-let {CSSRules} = require("cssRules");
+let {ElemHideEmulation} = require("elemHideEmulation");
let {defaultMatcher} = require("matcher");
-let {ActiveFilter, RegExpFilter, ElemHideBase, CSSPropertyFilter} =
+let {ActiveFilter, RegExpFilter, ElemHideBase, ElemHideEmulationFilter} =
require("filterClasses");
let {Prefs} = require("prefs");
/**
* Increases on filter changes, filters will be saved if it exceeds 1.
* @type Integer
*/
let isDirty = 0;
@@ -137,18 +137,18 @@
hasEnabled = true;
if (!hasEnabled)
return;
if (filter instanceof RegExpFilter)
defaultMatcher.add(filter);
else if (filter instanceof ElemHideBase)
{
- if (filter instanceof CSSPropertyFilter)
- CSSRules.add(filter);
+ if (filter instanceof ElemHideEmulationFilter)
+ ElemHideEmulation.add(filter);
else
ElemHide.add(filter);
}
}
/**
* Notifies Matcher instances or ElemHide object about removal of a filter
* if necessary.
@@ -168,18 +168,18 @@
if (hasEnabled)
return;
}
if (filter instanceof RegExpFilter)
defaultMatcher.remove(filter);
else if (filter instanceof ElemHideBase)
{
- if (filter instanceof CSSPropertyFilter)
- CSSRules.remove(filter);
+ if (filter instanceof ElemHideEmulationFilter)
+ ElemHideEmulation.remove(filter);
else
ElemHide.remove(filter);
}
}
const primes = [101, 109, 131, 149, 163, 179, 193, 211, 229, 241];
function addFilters(filters)
@@ -291,17 +291,17 @@
}
function onLoad()
{
isDirty = 0;
defaultMatcher.clear();
ElemHide.clear();
- CSSRules.clear();
+ ElemHideEmulation.clear();
for (let subscription of FilterStorage.subscriptions)
if (!subscription.disabled)
addFilters(subscription.filters);
}
function onSave()
{
isDirty = 0;

Powered by Google App Engine
This is Rietveld