| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Subscription.fromURL("~eh~").defaults = ["elemhide"]; | 57 Subscription.fromURL("~eh~").defaults = ["elemhide"]; |
| 58 | 58 |
| 59 callback(); | 59 callback(); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 function checkKnownFilters(test, text, expected) | 62 function checkKnownFilters(test, text, expected) |
| 63 { | 63 { |
| 64 let result = {}; | 64 let result = {}; |
| 65 for (let type of ["blacklist", "whitelist"]) | 65 for (let type of ["blacklist", "whitelist"]) |
| 66 { | 66 { |
| 67 let matcher = defaultMatcher[type]; | 67 let matcher = defaultMatcher["_" + type]; |
| 68 let filters = []; | 68 let filters = []; |
| 69 for (let [keyword, set] of matcher.filterByKeyword) | 69 for (let [keyword, set] of matcher._filterByKeyword) |
| 70 { | 70 { |
| 71 for (let filter of set) | 71 for (let filter of set) |
| 72 { | 72 { |
| 73 test.equal(matcher.findKeyword(filter), keyword, | 73 test.equal(matcher.findKeyword(filter), keyword, |
| 74 "Keyword of filter " + filter.text); | 74 "Keyword of filter " + filter.text); |
| 75 filters.push(filter.text); | 75 filters.push(filter.text); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 result[type] = filters; | 78 result[type] = filters; |
| 79 } | 79 } |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); | 356 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); |
| 357 | 357 |
| 358 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); | 358 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); |
| 359 subscription4.filters = [filter3]; | 359 subscription4.filters = [filter3]; |
| 360 | 360 |
| 361 filterStorage.addSubscription(subscription4); | 361 filterStorage.addSubscription(subscription4); |
| 362 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); | 362 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); |
| 363 | 363 |
| 364 test.done(); | 364 test.done(); |
| 365 }; | 365 }; |
| OLD | NEW |