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

Unified Diff: test/filterListener.js

Issue 29783618: Issue 6665 - Split out element hiding exceptions into their own module (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add lib/elemHideExceptions.js Created Aug. 7, 2018, 2:18 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
« no previous file with comments | « test/elemHideEmulation.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterListener.js
===================================================================
--- a/test/filterListener.js
+++ b/test/filterListener.js
@@ -20,36 +20,36 @@
const {createSandbox} = require("./_common");
let sandboxedRequire = null;
let FilterStorage = null;
let Subscription = null;
let Filter = null;
let defaultMatcher = null;
let SpecialSubscription = null;
-let ElemHideException = null;
exports.setUp = function(callback)
{
sandboxedRequire = createSandbox({
extraExports: {
elemHide: ["knownFilters"],
elemHideEmulation: ["filters"],
+ elemHideExceptions: ["knownExceptions"],
snippets: ["filters"]
}
});
// We need to require the filterListener module so that filter changes will be
// noticed, even though we don't directly use the module here.
sandboxedRequire("../lib/filterListener");
(
{FilterStorage} = sandboxedRequire("../lib/filterStorage"),
{Subscription, SpecialSubscription} = sandboxedRequire("../lib/subscriptionClasses"),
- {Filter, ElemHideException} = sandboxedRequire("../lib/filterClasses"),
+ {Filter} = sandboxedRequire("../lib/filterClasses"),
{defaultMatcher} = sandboxedRequire("../lib/matcher")
);
FilterStorage.addSubscription(Subscription.fromURL("~fl~"));
FilterStorage.addSubscription(Subscription.fromURL("~wl~"));
FilterStorage.addSubscription(Subscription.fromURL("~eh~"));
Subscription.fromURL("~fl~").defaults = ["blocking"];
@@ -76,24 +76,23 @@
filters.push(filter.text);
}
}
result[type] = filters;
}
let elemHide = sandboxedRequire("../lib/elemHide");
result.elemhide = [];
+ for (let filter of elemHide.knownFilters)
+ result.elemhide.push(filter.text);
+
+ let elemHideExceptions = sandboxedRequire("../lib/elemHideExceptions");
result.elemhideexception = [];
- for (let filter of elemHide.knownFilters)
- {
- if (filter instanceof ElemHideException)
- result.elemhideexception.push(filter.text);
- else
- result.elemhide.push(filter.text);
- }
+ for (let exception of elemHideExceptions.knownExceptions)
+ result.elemhideexception.push(exception.text);
let elemHideEmulation = sandboxedRequire("../lib/elemHideEmulation");
result.elemhideemulation = [];
for (let filterText of elemHideEmulation.filters)
result.elemhideemulation.push(filterText);
let snippets = sandboxedRequire("../lib/snippets");
result.snippets = [];
« no previous file with comments | « test/elemHideEmulation.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld