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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 testActive(test, "foo", "example.com", true, false); | 47 testActive(test, "foo", "example.com", true, false); |
48 testActive(test, "foo", "example.com.", true, false); | 48 testActive(test, "foo", "example.com.", true, false); |
49 testActive(test, "foo", "foo.example.com", true, false); | 49 testActive(test, "foo", "foo.example.com", true, false); |
50 testActive(test, "foo", "mple.com", true, false); | 50 testActive(test, "foo", "mple.com", true, false); |
51 | 51 |
52 test.done(); | 52 test.done(); |
53 }; | 53 }; |
54 | 54 |
55 exports.testUnrestrictedHidingRules = function(test) | 55 exports.testUnrestrictedHidingRules = function(test) |
56 { | 56 { |
57 testActive(test, "#foo", null, true, false); | 57 testActive(test, "##foo", null, true, false); |
58 testActive(test, "#foo", "com", true, false); | 58 testActive(test, "##foo", "com", true, false); |
59 testActive(test, "#foo", "example.com", true, false); | 59 testActive(test, "##foo", "example.com", true, false); |
60 testActive(test, "#foo", "example.com.", true, false); | 60 testActive(test, "##foo", "example.com.", true, false); |
61 testActive(test, "#foo", "foo.example.com", true, false); | 61 testActive(test, "##foo", "foo.example.com", true, false); |
62 testActive(test, "#foo", "mple.com", true, false); | 62 testActive(test, "##foo", "mple.com", true, false); |
63 | 63 |
64 test.done(); | 64 test.done(); |
65 }; | 65 }; |
66 | 66 |
67 exports.testDomainRestrictedBlockingFilters = function(test) | 67 exports.testDomainRestrictedBlockingFilters = function(test) |
68 { | 68 { |
69 testActive(test, "foo$domain=example.com", null, false, false); | 69 testActive(test, "foo$domain=example.com", null, false, false); |
70 testActive(test, "foo$domain=example.com", "com", false, true); | 70 testActive(test, "foo$domain=example.com", "com", false, true); |
71 testActive(test, "foo$domain=example.com", "example.com", true, true); | 71 testActive(test, "foo$domain=example.com", "example.com", true, true); |
72 testActive(test, "foo$domain=example.com", "example.com.", true, true); | 72 testActive(test, "foo$domain=example.com", "example.com.", true, true); |
73 testActive(test, "foo$domain=example.com.", "example.com", true, true); | 73 testActive(test, "foo$domain=example.com.", "example.com", true, true); |
74 testActive(test, "foo$domain=example.com.", "example.com.", true, true); | 74 testActive(test, "foo$domain=example.com.", "example.com.", true, true); |
75 testActive(test, "foo$domain=example.com", "foo.example.com", true, false); | 75 testActive(test, "foo$domain=example.com", "foo.example.com", true, false); |
76 testActive(test, "foo$domain=example.com", "mple.com", false, false); | 76 testActive(test, "foo$domain=example.com", "mple.com", false, false); |
77 | 77 |
78 test.done(); | 78 test.done(); |
79 }; | 79 }; |
80 | 80 |
81 exports.testDomainRestrictedHidingRules = function(test) | 81 exports.testDomainRestrictedHidingRules = function(test) |
82 { | 82 { |
83 testActive(test, "example.com#foo", null, false, false); | 83 testActive(test, "example.com##foo", null, false, false); |
84 testActive(test, "example.com#foo", "com", false, true); | 84 testActive(test, "example.com##foo", "com", false, true); |
85 testActive(test, "example.com#foo", "example.com", true, true); | 85 testActive(test, "example.com##foo", "example.com", true, true); |
86 testActive(test, "example.com#foo", "example.com.", false, false); | 86 testActive(test, "example.com##foo", "example.com.", false, false); |
87 testActive(test, "example.com.#foo", "example.com", false, false); | 87 testActive(test, "example.com.##foo", "example.com", false, false); |
88 testActive(test, "example.com.#foo", "example.com.", true, true); | 88 testActive(test, "example.com.##foo", "example.com.", true, true); |
89 testActive(test, "example.com#foo", "foo.example.com", true, false); | 89 testActive(test, "example.com##foo", "foo.example.com", true, false); |
90 testActive(test, "example.com#foo", "mple.com", false, false); | 90 testActive(test, "example.com##foo", "mple.com", false, false); |
91 | 91 |
92 test.done(); | 92 test.done(); |
93 }; | 93 }; |
94 | 94 |
95 exports.testBlockingFiltersRestrictedToDomainAndItsSubdomain = function(test) | 95 exports.testBlockingFiltersRestrictedToDomainAndItsSubdomain = function(test) |
96 { | 96 { |
97 testActive(test, "foo$domain=example.com|foo.example.com", null, false, false)
; | 97 testActive(test, "foo$domain=example.com|foo.example.com", null, false, false)
; |
98 testActive(test, "foo$domain=example.com|foo.example.com", "com", false, true)
; | 98 testActive(test, "foo$domain=example.com|foo.example.com", "com", false, true)
; |
99 testActive(test, "foo$domain=example.com|foo.example.com", "example.com", true
, true); | 99 testActive(test, "foo$domain=example.com|foo.example.com", "example.com", true
, true); |
100 testActive(test, "foo$domain=example.com|foo.example.com", "example.com.", tru
e, true); | 100 testActive(test, "foo$domain=example.com|foo.example.com", "example.com.", tru
e, true); |
101 testActive(test, "foo$domain=example.com|foo.example.com", "foo.example.com",
true, false); | 101 testActive(test, "foo$domain=example.com|foo.example.com", "foo.example.com",
true, false); |
102 testActive(test, "foo$domain=example.com|foo.example.com", "mple.com", false,
false); | 102 testActive(test, "foo$domain=example.com|foo.example.com", "mple.com", false,
false); |
103 | 103 |
104 test.done(); | 104 test.done(); |
105 }; | 105 }; |
106 | 106 |
107 exports.testHidingRulesRestrictedToDomainAndItsSubdomain = function(test) | 107 exports.testHidingRulesRestrictedToDomainAndItsSubdomain = function(test) |
108 { | 108 { |
109 testActive(test, "example.com,foo.example.com#foo", null, false, false); | 109 testActive(test, "example.com,foo.example.com##foo", null, false, false); |
110 testActive(test, "example.com,foo.example.com#foo", "com", false, true); | 110 testActive(test, "example.com,foo.example.com##foo", "com", false, true); |
111 testActive(test, "example.com,foo.example.com#foo", "example.com", true, true)
; | 111 testActive(test, "example.com,foo.example.com##foo", "example.com", true, true
); |
112 testActive(test, "example.com,foo.example.com#foo", "example.com.", false, fal
se); | 112 testActive(test, "example.com,foo.example.com##foo", "example.com.", false, fa
lse); |
113 testActive(test, "example.com,foo.example.com#foo", "foo.example.com", true, f
alse); | 113 testActive(test, "example.com,foo.example.com##foo", "foo.example.com", true,
false); |
114 testActive(test, "example.com,foo.example.com#foo", "mple.com", false, false); | 114 testActive(test, "example.com,foo.example.com##foo", "mple.com", false, false)
; |
115 | 115 |
116 test.done(); | 116 test.done(); |
117 }; | 117 }; |
118 | 118 |
119 exports.testBlockingFiltersWithExceptionForASubdomain = function(test) | 119 exports.testBlockingFiltersWithExceptionForASubdomain = function(test) |
120 { | 120 { |
121 testActive(test, "foo$domain=~foo.example.com", null, true, false); | 121 testActive(test, "foo$domain=~foo.example.com", null, true, false); |
122 testActive(test, "foo$domain=~foo.example.com", "com", true, false); | 122 testActive(test, "foo$domain=~foo.example.com", "com", true, false); |
123 testActive(test, "foo$domain=~foo.example.com", "example.com", true, false); | 123 testActive(test, "foo$domain=~foo.example.com", "example.com", true, false); |
124 testActive(test, "foo$domain=~foo.example.com", "example.com.", true, false); | 124 testActive(test, "foo$domain=~foo.example.com", "example.com.", true, false); |
125 testActive(test, "foo$domain=~foo.example.com", "foo.example.com", false, fals
e); | 125 testActive(test, "foo$domain=~foo.example.com", "foo.example.com", false, fals
e); |
126 testActive(test, "foo$domain=~foo.example.com", "mple.com", true, false); | 126 testActive(test, "foo$domain=~foo.example.com", "mple.com", true, false); |
127 | 127 |
128 test.done(); | 128 test.done(); |
129 }; | 129 }; |
130 | 130 |
131 exports.testHidingRulesWithExceptionForASubdomain = function(test) | 131 exports.testHidingRulesWithExceptionForASubdomain = function(test) |
132 { | 132 { |
133 testActive(test, "~foo.example.com#foo", null, true, false); | 133 testActive(test, "~foo.example.com##foo", null, true, false); |
134 testActive(test, "~foo.example.com#foo", "com", true, false); | 134 testActive(test, "~foo.example.com##foo", "com", true, false); |
135 testActive(test, "~foo.example.com#foo", "example.com", true, false); | 135 testActive(test, "~foo.example.com##foo", "example.com", true, false); |
136 testActive(test, "~foo.example.com#foo", "example.com.", true, false); | 136 testActive(test, "~foo.example.com##foo", "example.com.", true, false); |
137 testActive(test, "~foo.example.com#foo", "foo.example.com", false, false); | 137 testActive(test, "~foo.example.com##foo", "foo.example.com", false, false); |
138 testActive(test, "~foo.example.com#foo", "mple.com", true, false); | 138 testActive(test, "~foo.example.com##foo", "mple.com", true, false); |
139 | 139 |
140 test.done(); | 140 test.done(); |
141 }; | 141 }; |
142 | 142 |
143 exports.testBlockingFiltersForDomainButNotItsSubdomain = function(test) | 143 exports.testBlockingFiltersForDomainButNotItsSubdomain = function(test) |
144 { | 144 { |
145 testActive(test, "foo$domain=example.com|~foo.example.com", null, false, false
); | 145 testActive(test, "foo$domain=example.com|~foo.example.com", null, false, false
); |
146 testActive(test, "foo$domain=example.com|~foo.example.com", "com", false, true
); | 146 testActive(test, "foo$domain=example.com|~foo.example.com", "com", false, true
); |
147 testActive(test, "foo$domain=example.com|~foo.example.com", "example.com", tru
e, true); | 147 testActive(test, "foo$domain=example.com|~foo.example.com", "example.com", tru
e, true); |
148 testActive(test, "foo$domain=example.com|~foo.example.com", "example.com.", tr
ue, true); | 148 testActive(test, "foo$domain=example.com|~foo.example.com", "example.com.", tr
ue, true); |
149 testActive(test, "foo$domain=example.com|~foo.example.com", "foo.example.com",
false, false); | 149 testActive(test, "foo$domain=example.com|~foo.example.com", "foo.example.com",
false, false); |
150 testActive(test, "foo$domain=example.com|~foo.example.com", "mple.com", false,
false); | 150 testActive(test, "foo$domain=example.com|~foo.example.com", "mple.com", false,
false); |
151 | 151 |
152 test.done(); | 152 test.done(); |
153 }; | 153 }; |
154 | 154 |
155 exports.testHidingRulesForDomainButNotItsSubdomain = function(test) | 155 exports.testHidingRulesForDomainButNotItsSubdomain = function(test) |
156 { | 156 { |
157 testActive(test, "example.com,~foo.example.com#foo", null, false, false); | 157 testActive(test, "example.com,~foo.example.com##foo", null, false, false); |
158 testActive(test, "example.com,~foo.example.com#foo", "com", false, true); | 158 testActive(test, "example.com,~foo.example.com##foo", "com", false, true); |
159 testActive(test, "example.com,~foo.example.com#foo", "example.com", true, true
); | 159 testActive(test, "example.com,~foo.example.com##foo", "example.com", true, tru
e); |
160 testActive(test, "example.com,~foo.example.com#foo", "example.com.", false, fa
lse); | 160 testActive(test, "example.com,~foo.example.com##foo", "example.com.", false, f
alse); |
161 testActive(test, "example.com,~foo.example.com#foo", "foo.example.com", false,
false); | 161 testActive(test, "example.com,~foo.example.com##foo", "foo.example.com", false
, false); |
162 testActive(test, "example.com,~foo.example.com#foo", "mple.com", false, false)
; | 162 testActive(test, "example.com,~foo.example.com##foo", "mple.com", false, false
); |
163 | 163 |
164 test.done(); | 164 test.done(); |
165 }; | 165 }; |
166 | 166 |
167 exports.testBlockingFiltersForDomainButNotItsTLD = function(test) | 167 exports.testBlockingFiltersForDomainButNotItsTLD = function(test) |
168 { | 168 { |
169 testActive(test, "foo$domain=example.com|~com", null, false, false); | 169 testActive(test, "foo$domain=example.com|~com", null, false, false); |
170 testActive(test, "foo$domain=example.com|~com", "com", false, true); | 170 testActive(test, "foo$domain=example.com|~com", "com", false, true); |
171 testActive(test, "foo$domain=example.com|~com", "example.com", true, true); | 171 testActive(test, "foo$domain=example.com|~com", "example.com", true, true); |
172 testActive(test, "foo$domain=example.com|~com", "example.com.", true, true); | 172 testActive(test, "foo$domain=example.com|~com", "example.com.", true, true); |
173 testActive(test, "foo$domain=example.com|~com", "foo.example.com", true, false
); | 173 testActive(test, "foo$domain=example.com|~com", "foo.example.com", true, false
); |
174 testActive(test, "foo$domain=example.com|~com", "mple.com", false, false); | 174 testActive(test, "foo$domain=example.com|~com", "mple.com", false, false); |
175 | 175 |
176 test.done(); | 176 test.done(); |
177 }; | 177 }; |
178 | 178 |
179 exports.testHidingRulesForDomainButNotItsTLD = function(test) | 179 exports.testHidingRulesForDomainButNotItsTLD = function(test) |
180 { | 180 { |
181 testActive(test, "example.com,~com#foo", null, false, false); | 181 testActive(test, "example.com,~com##foo", null, false, false); |
182 testActive(test, "example.com,~com#foo", "com", false, true); | 182 testActive(test, "example.com,~com##foo", "com", false, true); |
183 testActive(test, "example.com,~com#foo", "example.com", true, true); | 183 testActive(test, "example.com,~com##foo", "example.com", true, true); |
184 testActive(test, "example.com,~com#foo", "example.com.", false, false); | 184 testActive(test, "example.com,~com##foo", "example.com.", false, false); |
185 testActive(test, "example.com,~com#foo", "foo.example.com", true, false); | 185 testActive(test, "example.com,~com##foo", "foo.example.com", true, false); |
186 testActive(test, "example.com,~com#foo", "mple.com", false, false); | 186 testActive(test, "example.com,~com##foo", "mple.com", false, false); |
187 | 187 |
188 test.done(); | 188 test.done(); |
189 }; | 189 }; |
190 | 190 |
191 exports.testBlockingFiltersRestrictedToAnUnrelatedDomain = function(test) | 191 exports.testBlockingFiltersRestrictedToAnUnrelatedDomain = function(test) |
192 { | 192 { |
193 testActive(test, "foo$domain=nnnnnnn.nnn", null, false, false); | 193 testActive(test, "foo$domain=nnnnnnn.nnn", null, false, false); |
194 testActive(test, "foo$domain=nnnnnnn.nnn", "com", false, false); | 194 testActive(test, "foo$domain=nnnnnnn.nnn", "com", false, false); |
195 testActive(test, "foo$domain=nnnnnnn.nnn", "example.com", false, false); | 195 testActive(test, "foo$domain=nnnnnnn.nnn", "example.com", false, false); |
196 testActive(test, "foo$domain=nnnnnnn.nnn", "example.com.", false, false); | 196 testActive(test, "foo$domain=nnnnnnn.nnn", "example.com.", false, false); |
197 testActive(test, "foo$domain=nnnnnnn.nnn", "foo.example.com", false, false); | 197 testActive(test, "foo$domain=nnnnnnn.nnn", "foo.example.com", false, false); |
198 testActive(test, "foo$domain=nnnnnnn.nnn", "mple.com", false, false); | 198 testActive(test, "foo$domain=nnnnnnn.nnn", "mple.com", false, false); |
199 | 199 |
200 test.done(); | 200 test.done(); |
201 }; | 201 }; |
202 | 202 |
203 exports.testHidingRulesRestrictedToAnUnrelatedDomain = function(test) | 203 exports.testHidingRulesRestrictedToAnUnrelatedDomain = function(test) |
204 { | 204 { |
205 testActive(test, "nnnnnnn.nnn#foo", null, false, false); | 205 testActive(test, "nnnnnnn.nnn##foo", null, false, false); |
206 testActive(test, "nnnnnnn.nnn#foo", "com", false, false); | 206 testActive(test, "nnnnnnn.nnn##foo", "com", false, false); |
207 testActive(test, "nnnnnnn.nnn#foo", "example.com", false, false); | 207 testActive(test, "nnnnnnn.nnn##foo", "example.com", false, false); |
208 testActive(test, "nnnnnnn.nnn#foo", "example.com.", false, false); | 208 testActive(test, "nnnnnnn.nnn##foo", "example.com.", false, false); |
209 testActive(test, "nnnnnnn.nnn#foo", "foo.example.com", false, false); | 209 testActive(test, "nnnnnnn.nnn##foo", "foo.example.com", false, false); |
210 testActive(test, "nnnnnnn.nnn#foo", "mple.com", false, false); | 210 testActive(test, "nnnnnnn.nnn##foo", "mple.com", false, false); |
211 | 211 |
212 test.done(); | 212 test.done(); |
213 }; | 213 }; |
214 | |
OLD | NEW |