OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 12 matching lines...) Expand all Loading... |
23 let filterStorage = null; | 23 let filterStorage = null; |
24 let Subscription = null; | 24 let Subscription = null; |
25 let Filter = null; | 25 let Filter = null; |
26 let defaultMatcher = null; | 26 let defaultMatcher = null; |
27 let SpecialSubscription = null; | 27 let SpecialSubscription = null; |
28 | 28 |
29 exports.setUp = function(callback) | 29 exports.setUp = function(callback) |
30 { | 30 { |
31 sandboxedRequire = createSandbox({ | 31 sandboxedRequire = createSandbox({ |
32 extraExports: { | 32 extraExports: { |
33 elemHide: ["knownFilters"], | 33 elemHide: ["knownFilterText"], |
34 elemHideEmulation: ["filters"], | 34 elemHideEmulation: ["filters"], |
35 elemHideExceptions: ["knownExceptions"] | 35 elemHideExceptions: ["knownExceptions"] |
36 } | 36 } |
37 }); | 37 }); |
38 | 38 |
39 // We need to require the filterListener module so that filter changes will be | 39 // We need to require the filterListener module so that filter changes will be |
40 // noticed, even though we don't directly use the module here. | 40 // noticed, even though we don't directly use the module here. |
41 sandboxedRequire("../lib/filterListener"); | 41 sandboxedRequire("../lib/filterListener"); |
42 | 42 |
43 ( | 43 ( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 "Keyword of filter " + filter.text); | 76 "Keyword of filter " + filter.text); |
77 filters.push(filter.text); | 77 filters.push(filter.text); |
78 } | 78 } |
79 } | 79 } |
80 } | 80 } |
81 result[type] = filters; | 81 result[type] = filters; |
82 } | 82 } |
83 | 83 |
84 let elemHide = sandboxedRequire("../lib/elemHide"); | 84 let elemHide = sandboxedRequire("../lib/elemHide"); |
85 result.elemhide = []; | 85 result.elemhide = []; |
86 for (let filter of elemHide.knownFilters) | 86 for (let filterText of elemHide.knownFilterText) |
87 result.elemhide.push(filter.text); | 87 result.elemhide.push(filterText); |
88 | 88 |
89 let elemHideExceptions = sandboxedRequire("../lib/elemHideExceptions"); | 89 let elemHideExceptions = sandboxedRequire("../lib/elemHideExceptions"); |
90 result.elemhideexception = []; | 90 result.elemhideexception = []; |
91 for (let exception of elemHideExceptions.knownExceptions) | 91 for (let exception of elemHideExceptions.knownExceptions) |
92 result.elemhideexception.push(exception.text); | 92 result.elemhideexception.push(exception.text); |
93 | 93 |
94 let elemHideEmulation = sandboxedRequire("../lib/elemHideEmulation"); | 94 let elemHideEmulation = sandboxedRequire("../lib/elemHideEmulation"); |
95 result.elemhideemulation = []; | 95 result.elemhideemulation = []; |
96 for (let filter of elemHideEmulation.filters) | 96 for (let filter of elemHideEmulation.filters) |
97 result.elemhideemulation.push(filter.text); | 97 result.elemhideemulation.push(filter.text); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); | 367 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); |
368 | 368 |
369 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); | 369 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); |
370 subscription4.addFilter(filter3); | 370 subscription4.addFilter(filter3); |
371 | 371 |
372 filterStorage.addSubscription(subscription4); | 372 filterStorage.addSubscription(subscription4); |
373 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); | 373 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); |
374 | 374 |
375 test.done(); | 375 test.done(); |
376 }; | 376 }; |
OLD | NEW |