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

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29912636: Issue 7052 - Use string-based matching for literal patterns (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created Oct. 17, 2018, 1:34 a.m.
Right Patch Set: Move code back to lib/filterClasses.js Created Oct. 21, 2018, 11:46 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterClasses.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 compareFilter(test, "||content.server.com/files/*.php$rewrite=$1", ["type=filt erlist", "text=||content.server.com/files/*.php$rewrite=$1", "regexp=^[\\w\\-]+: \\/+(?!\\/)(?:[^\\/]+\\.)?content\\.server\\.com\\/files\\/.*\\.php", "matchCase =false", "rewrite=$1", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.SUBDOCUME NT | t.OBJECT | t.OBJECT_SUBREQUEST))]); 321 compareFilter(test, "||content.server.com/files/*.php$rewrite=$1", ["type=filt erlist", "text=||content.server.com/files/*.php$rewrite=$1", "regexp=^[\\w\\-]+: \\/+(?!\\/)(?:[^\\/]+\\.)?content\\.server\\.com\\/files\\/.*\\.php", "matchCase =false", "rewrite=$1", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.SUBDOCUME NT | t.OBJECT | t.OBJECT_SUBREQUEST))]);
322 322
323 // background and image should be the same for backwards compatibility 323 // background and image should be the same for backwards compatibility
324 compareFilter(test, "bla$image", ["type=filterlist", "text=bla$image", "conten tType=" + (t.IMAGE)]); 324 compareFilter(test, "bla$image", ["type=filterlist", "text=bla$image", "conten tType=" + (t.IMAGE)]);
325 compareFilter(test, "bla$background", ["type=filterlist", "text=bla$background ", "contentType=" + (t.IMAGE)]); 325 compareFilter(test, "bla$background", ["type=filterlist", "text=bla$background ", "contentType=" + (t.IMAGE)]);
326 compareFilter(test, "bla$~image", ["type=filterlist", "text=bla$~image", "cont entType=" + (defaultTypes & ~t.IMAGE)]); 326 compareFilter(test, "bla$~image", ["type=filterlist", "text=bla$~image", "cont entType=" + (defaultTypes & ~t.IMAGE)]);
327 compareFilter(test, "bla$~background", ["type=filterlist", "text=bla$~backgrou nd", "contentType=" + (defaultTypes & ~t.IMAGE)]); 327 compareFilter(test, "bla$~background", ["type=filterlist", "text=bla$~backgrou nd", "contentType=" + (defaultTypes & ~t.IMAGE)]);
328 328
329 compareFilter(test, "@@bla$~script,~other", ["type=whitelist", "text=@@bla$~sc ript,~other", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]); 329 compareFilter(test, "@@bla$~script,~other", ["type=whitelist", "text=@@bla$~sc ript,~other", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]);
330 compareFilter(test, "@@http://bla$~script,~other", ["type=whitelist", "text=@@ http://bla$~script,~other", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHE R))]); 330 compareFilter(test, "@@http://bla$~script,~other", ["type=whitelist", "text=@@ http://bla$~script,~other", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHE R))]);
331 compareFilter(test, "@@|ftp://bla$~script,~other", ["type=whitelist", "text=@@ |ftp://bla$~script,~other", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHE R))]); 331 compareFilter(test, "@@|ftp://bla$~script,~other", ["type=whitelist", "text=@@ |ftp://bla$~script,~other", "regexp=^ftp\\:\\/\\/bla", "contentType=" + (default Types & ~(t.SCRIPT | t.OTHER))]);
332 compareFilter(test, "@@bla$~script,~other,document", ["type=whitelist", "text= @@bla$~script,~other,document", "contentType=" + (defaultTypes & ~(t.SCRIPT | t. OTHER) | t.DOCUMENT)]); 332 compareFilter(test, "@@bla$~script,~other,document", ["type=whitelist", "text= @@bla$~script,~other,document", "contentType=" + (defaultTypes & ~(t.SCRIPT | t. OTHER) | t.DOCUMENT)]);
333 compareFilter(test, "@@bla$~script,~other,~document", ["type=whitelist", "text =@@bla$~script,~other,~document", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]); 333 compareFilter(test, "@@bla$~script,~other,~document", ["type=whitelist", "text =@@bla$~script,~other,~document", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]);
334 compareFilter(test, "@@bla$document", ["type=whitelist", "text=@@bla$document" , "contentType=" + t.DOCUMENT]); 334 compareFilter(test, "@@bla$document", ["type=whitelist", "text=@@bla$document" , "contentType=" + t.DOCUMENT]);
335 compareFilter(test, "@@bla$~script,~other,elemhide", ["type=whitelist", "text= @@bla$~script,~other,elemhide", "contentType=" + (defaultTypes & ~(t.SCRIPT | t. OTHER) | t.ELEMHIDE)]); 335 compareFilter(test, "@@bla$~script,~other,elemhide", ["type=whitelist", "text= @@bla$~script,~other,elemhide", "contentType=" + (defaultTypes & ~(t.SCRIPT | t. OTHER) | t.ELEMHIDE)]);
336 compareFilter(test, "@@bla$~script,~other,~elemhide", ["type=whitelist", "text =@@bla$~script,~other,~elemhide", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]); 336 compareFilter(test, "@@bla$~script,~other,~elemhide", ["type=whitelist", "text =@@bla$~script,~other,~elemhide", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]);
337 compareFilter(test, "@@bla$elemhide", ["type=whitelist", "text=@@bla$elemhide" , "contentType=" + t.ELEMHIDE]); 337 compareFilter(test, "@@bla$elemhide", ["type=whitelist", "text=@@bla$elemhide" , "contentType=" + t.ELEMHIDE]);
338 338
339 compareFilter(test, "@@bla$~script,~other,donottrack", ["type=invalid", "text= @@bla$~script,~other,donottrack", "reason=filter_unknown_option"]); 339 compareFilter(test, "@@bla$~script,~other,donottrack", ["type=invalid", "text= @@bla$~script,~other,donottrack", "reason=filter_unknown_option"]);
340 compareFilter(test, "@@bla$~script,~other,~donottrack", ["type=invalid", "text =@@bla$~script,~other,~donottrack", "reason=filter_unknown_option"]); 340 compareFilter(test, "@@bla$~script,~other,~donottrack", ["type=invalid", "text =@@bla$~script,~other,~donottrack", "reason=filter_unknown_option"]);
341 compareFilter(test, "@@bla$donottrack", ["type=invalid", "text=@@bla$donottrac k", "reason=filter_unknown_option"]); 341 compareFilter(test, "@@bla$donottrack", ["type=invalid", "text=@@bla$donottrac k", "reason=filter_unknown_option"]);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 629
630 test.notEqual(filter2.domains, filter5.domains); 630 test.notEqual(filter2.domains, filter5.domains);
631 631
632 // Check twice for element hiding filters to make sure the internal cached 632 // Check twice for element hiding filters to make sure the internal cached
633 // values are also not equal. 633 // values are also not equal.
634 test.notEqual(filter4.domains, filter6.domains); 634 test.notEqual(filter4.domains, filter6.domains);
635 test.notEqual(filter4.domains, filter6.domains); 635 test.notEqual(filter4.domains, filter6.domains);
636 636
637 test.done(); 637 test.done();
638 }; 638 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld