Index: test/filterClasses.js |
diff --git a/test/filterClasses.js b/test/filterClasses.js |
index a25d7673d0c44e0c3fbf771d400644ef83d00e16..cfc38d30eb909a2803959e9de5bc4a0485a48b66 100644 |
--- a/test/filterClasses.js |
+++ b/test/filterClasses.js |
@@ -17,11 +17,37 @@ |
"use strict"; |
-let { |
- Filter, InvalidFilter, CommentFilter, ActiveFilter, RegExpFilter, |
- BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, |
- ElemHideException, CSSPropertyFilter |
-} = require("../lib/filterClasses"); |
+let {createSandbox} = require("common"); |
+ |
+let Filter = null; |
+let InvalidFilter = null; |
+let CommentFilter = null; |
+let ActiveFilter = null; |
+let RegExpFilter = null; |
+let BlockingFilter = null; |
+let WhitelistFilter = null; |
+let ElemHideBase = null; |
+let ElemHideFilter = null; |
+let ElemHideException = null; |
+let CSSPropertyFilter = null; |
+ |
+let t = null; |
+let defaultTypes = null; |
+ |
+exports.setUp = function(callback) |
+{ |
+ let sandboxedRequire = createSandbox(); |
+ ( |
+ {Filter, InvalidFilter, CommentFilter, ActiveFilter, RegExpFilter, |
+ BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, |
+ ElemHideException, CSSPropertyFilter} = sandboxedRequire("filterClasses") |
+ ); |
+ t = RegExpFilter.typeMap; |
+ defaultTypes = 0x7FFFFFFF & ~(t.ELEMHIDE | t.DOCUMENT | t.POPUP | |
+ t.GENERICHIDE | t.GENERICBLOCK); |
+ |
+ callback(); |
+}; |
function serializeFilter(filter) |
{ |
@@ -244,9 +270,6 @@ exports.testFiltersWithState = function(test) |
test.done(); |
}; |
-let t = RegExpFilter.typeMap; |
-let defaultTypes = 0x7FFFFFFF & ~(t.ELEMHIDE | t.DOCUMENT | t.POPUP | t.GENERICHIDE | t.GENERICBLOCK); |
- |
exports.testSpecialCharacters = function(test) |
{ |
compareFilter(test, "/ddd|f?a[s]d/", ["type=filterlist", "text=/ddd|f?a[s]d/", "regexp=ddd|f?a[s]d"]); |