Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -15,17 +15,16 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
/** |
* @fileOverview Definition of Filter class and its subclasses. |
*/ |
let {FilterNotifier} = require("filterNotifier"); |
-let {Utils} = require("utils"); |
/** |
* Abstract base class for filters |
* |
* @param {String} text string representation of the filter |
* @constructor |
*/ |
function Filter(text) |
@@ -732,30 +731,30 @@ RegExpFilter.fromText = function(text) |
thirdParty = false; |
else if (option == "COLLAPSE") |
collapse = true; |
else if (option == "~COLLAPSE") |
collapse = false; |
else if (option == "SITEKEY" && typeof value != "undefined") |
sitekeys = value; |
else |
- return new InvalidFilter(origText, "Unknown option " + option.toLowerCase()); |
+ return new InvalidFilter(origText, "filter_unknown_option"); |
} |
} |
try |
{ |
if (blocking) |
return new BlockingFilter(origText, text, contentType, matchCase, domains, thirdParty, sitekeys, collapse); |
else |
return new WhitelistFilter(origText, text, contentType, matchCase, domains, thirdParty, sitekeys); |
} |
catch (e) |
{ |
- return new InvalidFilter(origText, e); |
+ return new InvalidFilter(origText, "filter_invalid_regexp"); |
} |
}; |
/** |
* Maps type strings like "SCRIPT" or "OBJECT" to bit masks |
*/ |
RegExpFilter.typeMap = { |
OTHER: 1, |
@@ -922,41 +921,41 @@ ElemHideBase.fromText = function(text, d |
if (separatorPos > 0) |
{ |
rule = rule.replace(/=/, '="') + '"'; |
additional += "[" + rule + "]"; |
} |
else |
{ |
if (id) |
- return new InvalidFilter(text, Utils.getString("filter_elemhide_duplicate_id")); |
+ return new InvalidFilter(text, "filter_elemhide_duplicate_id"); |
id = rule; |
} |
} |
} |
if (id) |
selector = tagName + "." + id + additional + "," + tagName + "#" + id + additional; |
else if (tagName || additional) |
selector = tagName + additional; |
else |
- return new InvalidFilter(text, Utils.getString("filter_elemhide_nocriteria")); |
+ return new InvalidFilter(text, "filter_elemhide_nocriteria"); |
} |
if (isException) |
return new ElemHideException(text, domain, selector); |
let match = Filter.csspropertyRegExp.exec(selector); |
if (match) |
{ |
// CSS property filters are inefficient so we need to make sure that |
// they're only applied if they specify active domains |
if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) |
- return new InvalidFilter(text, Utils.getString("filter_cssproperty_nodomain")); |
+ return new InvalidFilter(text, "filter_cssproperty_nodomain"); |
return new CSSPropertyFilter(text, domain, selector, match[2], |
selector.substr(0, match.index), |
selector.substr(match.index + match[0].length)); |
} |
return new ElemHideFilter(text, domain, selector); |
}; |