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

Side by Side Diff: test/abp2blocklist.js

Issue 29457578: Issue 4327 - Do not apply $subdocument filters to top-level documents (Closed) Base URL: https://hg.adblockplus.org/abp2blocklist
Patch Set: Created June 6, 2017, 12:50 p.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/abp2blocklist.js ('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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 testRules(test, ["~test.com##whatever"], []); 80 testRules(test, ["~test.com##whatever"], []);
81 81
82 test.done(); 82 test.done();
83 }, 83 },
84 84
85 testRequestFilters: function(test) 85 testRequestFilters: function(test)
86 { 86 {
87 testRules(test, ["/foo", "||test.com", "http://example.com/foo"], [ 87 testRules(test, ["/foo", "||test.com", "http://example.com/foo"], [
88 {trigger: {"url-filter": "^https?://.*/foo", 88 {trigger: {"url-filter": "^https?://.*/foo",
89 "resource-type": ["image", "style-sheet", "script", "font", 89 "resource-type": ["image", "style-sheet", "script", "font",
90 "media", "raw", "document"]}, 90 "media", "raw", "document"],
91 "unless-top-url": ["^https?://.*/foo"]},
91 action: {type: "block"}}, 92 action: {type: "block"}},
92 {trigger: {"url-filter": "^https?://([^/]+\\.)?test\\.com", 93 {trigger: {"url-filter": "^https?://([^/]+\\.)?test\\.com",
93 "url-filter-is-case-sensitive": true, 94 "url-filter-is-case-sensitive": true,
94 "resource-type": ["image", "style-sheet", "script", "font", 95 "resource-type": ["image", "style-sheet", "script", "font",
95 "media", "raw", "document"]}, 96 "media", "raw", "document"],
97 "unless-top-url": ["^https?://([^/]+\\.)?test\\.com"],
98 "top-url-filter-is-case-sensitive": true},
96 action: {type: "block"}}, 99 action: {type: "block"}},
97 {trigger: {"url-filter": "http://example\\.com/foo", 100 {trigger: {"url-filter": "http://example\\.com/foo",
98 "resource-type": ["image", "style-sheet", "script", "font", 101 "resource-type": ["image", "style-sheet", "script", "font",
99 "media", "raw", "document"]}, 102 "media", "raw", "document"],
103 "unless-top-url": ["http://example\\.com/foo"]},
100 action: {type: "block"}} 104 action: {type: "block"}}
101 ]); 105 ]);
102 106
103 testRules(test, ["||example.com"], [ 107 testRules(test, ["||example.com"], [
104 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com", 108 {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com",
105 "url-filter-is-case-sensitive": true, 109 "url-filter-is-case-sensitive": true,
106 "resource-type": ["image", "style-sheet", "script", "font", 110 "resource-type": ["image", "style-sheet", "script", "font",
107 "media", "raw", "document"]}, 111 "media", "raw", "document"],
112 "unless-top-url": ["^https?://([^/]+\\.)?example\\.com"],
113 "top-url-filter-is-case-sensitive": true},
108 114
109 action: {type: "block"}} 115 action: {type: "block"}}
110 ]); 116 ]);
111 117
112 // Rules which would match no resource-types shouldn't be generated. 118 // Rules which would match no resource-types shouldn't be generated.
113 testRules(test, ["foo$document", "||foo.com$document"], []); 119 testRules(test, ["foo$document", "||foo.com$document"], []);
114 120
115 test.done(); 121 test.done();
116 }, 122 },
117 123
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 testUnicode: function(test) 275 testUnicode: function(test)
270 { 276 {
271 testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"], 277 testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"],
272 rules => rules[0]["trigger"]["if-domain"]); 278 rules => rules[0]["trigger"]["if-domain"]);
273 testRules(test, ["🐈$domain=🐈.cat"], []); 279 testRules(test, ["🐈$domain=🐈.cat"], []);
274 testRules(test, ["###🐈"], []); 280 testRules(test, ["###🐈"], []);
275 281
276 test.done(); 282 test.done();
277 } 283 }
278 }; 284 };
OLDNEW
« no previous file with comments | « lib/abp2blocklist.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld