Index: lib/filterClasses.js |
diff --git a/lib/filterClasses.js b/lib/filterClasses.js |
index 5a8ac6d77bf116ace79ceebbbf3df1b02dc11fc6..c17187571366caac15c3dae895b7c8267515bb32 100644 |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -20,6 +20,7 @@ |
*/ |
let {FilterNotifier} = require("filterNotifier"); |
+let {desc} = require("coreUtils"); |
/** |
* Abstract base class for filters |
@@ -210,10 +211,7 @@ function InvalidFilter(text, reason) |
} |
exports.InvalidFilter = InvalidFilter; |
-InvalidFilter.prototype = |
-{ |
- __proto__: Filter.prototype, |
- |
+InvalidFilter.prototype = Object.create(Filter.prototype, desc({ |
type: "invalid", |
/** |
@@ -226,7 +224,7 @@ InvalidFilter.prototype = |
* See Filter.serialize() |
*/ |
serialize: function(buffer) {} |
-}; |
+})); |
/** |
* Class for comments |
@@ -240,17 +238,14 @@ function CommentFilter(text) |
} |
exports.CommentFilter = CommentFilter; |
-CommentFilter.prototype = |
-{ |
- __proto__: Filter.prototype, |
- |
+CommentFilter.prototype = Object.create(Filter.prototype, desc({ |
type: "comment", |
/** |
* See Filter.serialize() |
*/ |
serialize: function(buffer) {} |
-}; |
+})); |
/** |
* Abstract base class for filters that can get hits |
@@ -267,10 +262,7 @@ function ActiveFilter(text, domains) |
} |
exports.ActiveFilter = ActiveFilter; |
-ActiveFilter.prototype = |
-{ |
- __proto__: Filter.prototype, |
- |
+ActiveFilter.prototype = Object.create(Filter.prototype, desc({ |
_disabled: false, |
_hitCount: 0, |
_lastHit: 0, |
@@ -515,7 +507,7 @@ ActiveFilter.prototype = |
buffer.push("lastHit=" + this._lastHit); |
} |
} |
-}; |
+})); |
/** |
* Abstract base class for RegExp-based filters |
@@ -556,10 +548,7 @@ function RegExpFilter(text, regexpSource, contentType, matchCase, domains, third |
} |
exports.RegExpFilter = RegExpFilter; |
-RegExpFilter.prototype = |
-{ |
- __proto__: ActiveFilter.prototype, |
- |
+RegExpFilter.prototype = Object.create(ActiveFilter.prototype, desc({ |
/** |
* @see ActiveFilter.domainSourceIsUpperCase |
*/ |
@@ -664,7 +653,7 @@ RegExpFilter.prototype = |
return false; |
} |
-}; |
+})); |
// Required to optimize Matcher, see also RegExpFilter.prototype.length |
Object.defineProperty(RegExpFilter.prototype, "0", |
@@ -810,10 +799,7 @@ function BlockingFilter(text, regexpSource, contentType, matchCase, domains, thi |
} |
exports.BlockingFilter = BlockingFilter; |
-BlockingFilter.prototype = |
-{ |
- __proto__: RegExpFilter.prototype, |
- |
+BlockingFilter.prototype = Object.create(RegExpFilter.prototype, desc({ |
type: "blocking", |
/** |
@@ -821,7 +807,7 @@ BlockingFilter.prototype = |
* @type Boolean |
*/ |
collapse: null |
-}; |
+})); |
/** |
* Class for whitelist filters |
@@ -841,12 +827,9 @@ function WhitelistFilter(text, regexpSource, contentType, matchCase, domains, th |
} |
exports.WhitelistFilter = WhitelistFilter; |
-WhitelistFilter.prototype = |
-{ |
- __proto__: RegExpFilter.prototype, |
- |
+WhitelistFilter.prototype = Object.create(RegExpFilter.prototype, desc({ |
type: "whitelist" |
-}; |
+})); |
/** |
* Base class for element hiding filters |
@@ -866,10 +849,7 @@ function ElemHideBase(text, domains, selector) |
} |
exports.ElemHideBase = ElemHideBase; |
-ElemHideBase.prototype = |
-{ |
- __proto__: ActiveFilter.prototype, |
- |
+ElemHideBase.prototype = Object.create(ActiveFilter.prototype, desc({ |
/** |
* @see ActiveFilter.domainSeparator |
*/ |
@@ -890,7 +870,7 @@ ElemHideBase.prototype = |
* @type String |
*/ |
selector: null |
-}; |
+})); |
/** |
* Creates an element hiding filter from a pre-parsed text representation |
@@ -975,12 +955,9 @@ function ElemHideFilter(text, domains, selector) |
} |
exports.ElemHideFilter = ElemHideFilter; |
-ElemHideFilter.prototype = |
-{ |
- __proto__: ElemHideBase.prototype, |
- |
+ElemHideFilter.prototype = Object.create(ElemHideBase.prototype, desc({ |
type: "elemhide" |
-}; |
+})); |
/** |
* Class for element hiding exceptions |
@@ -996,12 +973,9 @@ function ElemHideException(text, domains, selector) |
} |
exports.ElemHideException = ElemHideException; |
-ElemHideException.prototype = |
-{ |
- __proto__: ElemHideBase.prototype, |
- |
+ElemHideException.prototype = Object.create(ElemHideBase.prototype, desc({ |
type: "elemhideexception" |
-}; |
+})); |
/** |
* Class for CSS property filters |
@@ -1025,10 +999,7 @@ function CSSPropertyFilter(text, domains, selector, regexpSource, |
} |
exports.CSSPropertyFilter = CSSPropertyFilter; |
-CSSPropertyFilter.prototype = |
-{ |
- __proto__: ElemHideBase.prototype, |
- |
+CSSPropertyFilter.prototype = Object.create(ElemHideBase.prototype, desc({ |
type: "cssproperty", |
/** |
@@ -1067,4 +1038,4 @@ CSSPropertyFilter.prototype = |
Object.defineProperty(this, "regexpString", {value: regexp}); |
return regexp; |
} |
-}; |
+})); |