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

Side by Side Diff: test/abp2blocklist.js

Issue 29438577: Issue 5248 - Use wildcard to match any subdomains (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created May 16, 2017, 1:06 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 | « package.json ('k') | no next file » | 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-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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 ["[id=example]", "[id=EXAMPLE]"], 126 ["[id=example]", "[id=EXAMPLE]"],
127 rules => rules.map(rule => rule.action.selector)); 127 rules => rules.map(rule => rule.action.selector));
128 128
129 test.done(); 129 test.done();
130 }, 130 },
131 131
132 testDomainWhitelisting: function(test) 132 testDomainWhitelisting: function(test)
133 { 133 {
134 testRules(test, ["@@||example.com^$document"], [ 134 testRules(test, ["@@||example.com^$document"], [
135 {trigger: {"url-filter": ".*", 135 {trigger: {"url-filter": ".*",
136 "if-domain": ["example.com", "www.example.com"]}, 136 "if-domain": ["*example.com"]},
137 action: {type: "ignore-previous-rules"}} 137 action: {type: "ignore-previous-rules"}}
138 ]); 138 ]);
139 testRules(test, ["@@||example.com^$document,image"], [ 139 testRules(test, ["@@||example.com^$document,image"], [
140 {trigger: {"url-filter": ".*", 140 {trigger: {"url-filter": ".*",
141 "if-domain": ["example.com", "www.example.com"]}, 141 "if-domain": ["*example.com"]},
142 action: {type: "ignore-previous-rules"}}, 142 action: {type: "ignore-previous-rules"}},
143 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com", 143 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com",
144 "url-filter-is-case-sensitive": true, 144 "url-filter-is-case-sensitive": true,
145 "resource-type": ["image"]}, 145 "resource-type": ["image"]},
146 action: {type: "ignore-previous-rules"}} 146 action: {type: "ignore-previous-rules"}}
147 ]); 147 ]);
148 testRules(test, ["@@||example.com/path^$font,document"], [ 148 testRules(test, ["@@||example.com/path^$font,document"], [
149 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com/path", 149 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com/path",
150 "resource-type": ["font"]}, 150 "resource-type": ["font"]},
151 action: {type: "ignore-previous-rules"}} 151 action: {type: "ignore-previous-rules"}}
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 { 206 {
207 // These types of filters are currently completely unsupported. 207 // These types of filters are currently completely unsupported.
208 testRules(test, ["foo$sitekey=bar", "@@foo$genericblock", 208 testRules(test, ["foo$sitekey=bar", "@@foo$genericblock",
209 "@@bar$generichide"], []); 209 "@@bar$generichide"], []);
210 210
211 test.done(); 211 test.done();
212 }, 212 },
213 213
214 testFilterOptions: function(test) 214 testFilterOptions: function(test)
215 { 215 {
216 testRules(test, ["1$domain=foo.com"], ["foo.com", "www.foo.com"], 216 testRules(test, ["1$domain=foo.com"], ["*foo.com"],
217 rules => rules[0]["trigger"]["if-domain"]); 217 rules => rules[0]["trigger"]["if-domain"]);
218 testRules(test, ["2$domain=third-party"], ["third-party"], 218 testRules(test, ["2$third-party"], ["third-party"],
Manish Jethani 2017/05/16 01:08:27 This test was wrong, I've fixed it.
219 rules => rules[0]["trigger"]["if-domain"]); 219 rules => rules[0]["trigger"]["load-type"]);
220 testRules(test, ["foo$match_case"], true, 220 testRules(test, ["foo$match_case"], true,
221 rules => rules[0]["trigger"]["url-filter-is-case-sensitive"]); 221 rules => rules[0]["trigger"]["url-filter-is-case-sensitive"]);
222 222
223 test.done(); 223 test.done();
224 }, 224 },
225 225
226 testUnicode: function(test) 226 testUnicode: function(test)
227 { 227 {
228 testRules(test, ["$domain=🐈.cat"], ["xn--zn8h.cat", "www.xn--zn8h.cat"], 228 testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"],
229 rules => rules[0]["trigger"]["if-domain"]); 229 rules => rules[0]["trigger"]["if-domain"]);
230 testRules(test, ["🐈$domain=🐈.cat"], []); 230 testRules(test, ["🐈$domain=🐈.cat"], []);
231 testRules(test, ["###🐈"], []); 231 testRules(test, ["###🐈"], []);
232 232
233 test.done(); 233 test.done();
234 } 234 }
235 }; 235 };
OLDNEW
« no previous file with comments | « package.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld