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

Side by Side Diff: test/domainRestrictions.js

Issue 29790629: Issue 6690 - Always ignore trailing dot in document domain (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Ignore trailing dot in ElemHide.getSelectorsForDomain Created May 26, 2018, 12:10 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | test/elemHide.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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", false, false);
74 testActive(test, "foo$domain=example.com.", "example.com.", true, true); 74 testActive(test, "foo$domain=example.com.", "example.com.", false, false);
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.", true, true);
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.", false, false);
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, fa lse); 112 testActive(test, "example.com,foo.example.com##foo", "example.com.", true, tru e);
113 testActive(test, "example.com,foo.example.com##foo", "foo.example.com", true, false); 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);
(...skipping 27 matching lines...) Expand all
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, tru e); 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, f alse); 160 testActive(test, "example.com,~foo.example.com##foo", "example.com.", true, tr ue);
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.", true, true);
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 };
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | test/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld