Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -298,26 +298,38 @@ ActiveFilter.prototype = |
/** |
* Determines whether the trailing dot in domain names isn't important and |
* should be ignored, must be overridden by subclasses. |
* @type Boolean |
*/ |
ignoreTrailingDot: true, |
/** |
+ * Determines whether domainSource is already upper-case, |
+ * can be overridden by subclasses. |
+ * @type Boolean |
+ */ |
+ domainSourceIsUpperCase: false, |
+ |
+ /** |
* Map containing domains that this filter should match on/not match on or null if the filter should match on all domains |
* @type Object |
*/ |
get domains() |
{ |
let domains = null; |
if (this.domainSource) |
{ |
- let list = this.domainSource.split(this.domainSeparator); |
+ let source = this.domainSource; |
+ if (!this.domainSourceIsUpperCase) { |
+ // RegExpFilter already have uppercase domains |
+ source = source.toUpperCase(); |
+ } |
+ let list = source.split(this.domainSeparator); |
if (list.length == 1 && list[0][0] != "~") |
{ |
// Fast track for the common one-domain scenario |
domains = {__proto__: null, "": false}; |
if (this.ignoreTrailingDot) |
list[0] = list[0].replace(/\.+$/, ""); |
domains[list[0]] = true; |
} |
@@ -347,17 +359,17 @@ ActiveFilter.prototype = |
if (!domains) |
domains = {__proto__: null}; |
domains[domain] = include; |
} |
domains[""] = !hasIncludes; |
} |
- delete this.domainSource; |
+ this.domainSource = null; |
} |
this.__defineGetter__("domains", function() domains); |
return this.domains; |
}, |
/** |
* Checks whether this filter is active on a domain. |
@@ -462,16 +474,21 @@ function RegExpFilter(text, regexpSource |
} |
exports.RegExpFilter = RegExpFilter; |
RegExpFilter.prototype = |
{ |
__proto__: ActiveFilter.prototype, |
/** |
+ * @see ActiveFilter.domainSourceIsUpperCase |
+ */ |
+ domainSourceIsUpperCase: true, |
+ |
+ /** |
* Number of filters contained, will always be 1 (required to optimize Matcher). |
* @type Integer |
*/ |
length: 1, |
/** |
* @see ActiveFilter.domainSeparator |
*/ |
@@ -740,17 +757,17 @@ WhitelistFilter.prototype = |
* @param {String} text see Filter() |
* @param {String} domains (optional) Host names or domains the filter should be restricted to |
* @param {String} selector CSS selector for the HTML elements that should be hidden |
* @constructor |
* @augments ActiveFilter |
*/ |
function ElemHideBase(text, domains, selector) |
{ |
- ActiveFilter.call(this, text, domains ? domains.toUpperCase() : null); |
+ ActiveFilter.call(this, text, domains || null); |
if (domains) |
this.selectorDomain = domains.replace(/,~[^,]+/g, "").replace(/^~[^,]+,?/, "").toLowerCase(); |
this.selector = selector; |
} |
exports.ElemHideBase = ElemHideBase; |
ElemHideBase.prototype = |