| Left: | ||
| Right: |
| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 "use strict"; | 18 "use strict"; |
| 19 | 19 |
| 20 let {createSandbox} = require("./_common"); | 20 const {createSandbox} = require("./_common"); |
| 21 | 21 |
| 22 let ElemHideEmulationFilter = null; | 22 let ElemHideEmulationFilter = null; |
| 23 let ElemHideEmulation = null; | 23 let ElemHideEmulation = null; |
| 24 let ElemHide = null; | 24 let ElemHide = null; |
| 25 let Filter = null; | 25 let Filter = null; |
| 26 | 26 |
| 27 exports.setUp = function(callback) | 27 exports.setUp = function(callback) |
| 28 { | 28 { |
| 29 let sandboxedRequire = createSandbox(); | 29 let sandboxedRequire = createSandbox(); |
| 30 ( | 30 ( |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 61 testSelectorMatches( | 61 testSelectorMatches( |
| 62 "Ignore generic filters", | 62 "Ignore generic filters", |
| 63 ["##[-abp-properties='foo']", "example.com##[-abp-properties='foo']", | 63 ["##[-abp-properties='foo']", "example.com##[-abp-properties='foo']", |
| 64 "~example.com##[-abp-properties='foo']"], | 64 "~example.com##[-abp-properties='foo']"], |
| 65 "example.com", | 65 "example.com", |
| 66 ["example.com##[-abp-properties='foo']"] | 66 ["example.com##[-abp-properties='foo']"] |
| 67 ); | 67 ); |
| 68 testSelectorMatches( | 68 testSelectorMatches( |
| 69 "Ignore selectors with exceptions", | 69 "Ignore selectors with exceptions", |
| 70 ["example.com##[-abp-properties='foo']", | 70 ["example.com##[-abp-properties='foo']", |
| 71 "example.com##[-abp-properties='bar']", | 71 "example.com##[-abp-properties='bar']", |
| 72 "example.com#@#[-abp-properties='foo']"], | 72 "example.com#@#[-abp-properties='foo']"], |
| 73 "example.com", | 73 "example.com", |
|
Wladimir Palant
2017/03/02 14:07:07
The indentation is wrong here. Should be:
[
"ex
kzar
2017/03/08 12:33:55
Done.
| |
| 74 ["example.com##[-abp-properties='bar']"] | 74 ["example.com##[-abp-properties='bar']"] |
| 75 ); | 75 ); |
| 76 testSelectorMatches( | 76 testSelectorMatches( |
| 77 "Ignore filters that include parent domain but exclude subdomain", | 77 "Ignore filters that include parent domain but exclude subdomain", |
| 78 ["~www.example.com,example.com##[-abp-properties='foo']"], | 78 ["~www.example.com,example.com##[-abp-properties='foo']"], |
| 79 "www.example.com", | 79 "www.example.com", |
|
Wladimir Palant
2017/03/02 14:07:07
The added indentation is wrong here, "www.example.
kzar
2017/03/08 12:33:54
Done.
| |
| 80 [] | 80 [] |
| 81 ); | 81 ); |
| 82 testSelectorMatches( | 82 testSelectorMatches( |
| 83 "Ignore filters with parent domain if exception matches subdomain", | 83 "Ignore filters with parent domain if exception matches subdomain", |
| 84 ["www.example.com#@#[-abp-properties='foo']", | 84 ["www.example.com#@#[-abp-properties='foo']", |
| 85 "example.com##[-abp-properties='foo']"], | 85 "example.com##[-abp-properties='foo']"], |
| 86 "www.example.com", | 86 "www.example.com", |
| 87 [] | 87 [] |
| 88 ); | 88 ); |
| 89 testSelectorMatches( | 89 testSelectorMatches( |
| 90 "Ignore filters for other subdomain", | 90 "Ignore filters for other subdomain", |
| 91 ["www.example.com##[-abp-properties='foo']", | 91 ["www.example.com##[-abp-properties='foo']", |
| 92 "other.example.com##[-abp-properties='foo']"], | 92 "other.example.com##[-abp-properties='foo']"], |
| 93 "other.example.com", | 93 "other.example.com", |
|
Wladimir Palant
2017/03/02 14:07:07
Indentation is wrong here. Should be:
[
"www.ex
kzar
2017/03/08 12:33:55
Done.
| |
| 94 ["other.example.com##[-abp-properties='foo']"] | 94 ["other.example.com##[-abp-properties='foo']"] |
| 95 ); | 95 ); |
| 96 | 96 |
| 97 test.done(); | 97 test.done(); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 exports.testElemHideEmulationFiltersContainer = function(test) | 100 exports.testElemHideEmulationFiltersContainer = function(test) |
| 101 { | 101 { |
| 102 function compareRules(description, domain, expectedMatches) | 102 function compareRules(description, domain, expectedMatches) |
| 103 { | 103 { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 129 | 129 |
| 130 ElemHideEmulation.clear(); | 130 ElemHideEmulation.clear(); |
| 131 compareRules( | 131 compareRules( |
| 132 "Return no filters after clearing", | 132 "Return no filters after clearing", |
| 133 "www.example.com", | 133 "www.example.com", |
| 134 [] | 134 [] |
| 135 ); | 135 ); |
| 136 | 136 |
| 137 test.done(); | 137 test.done(); |
| 138 }; | 138 }; |
| OLD | NEW |