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

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29861585: Issue 6871 - Reject filters with blank CSPs (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Address PS1 comments Created Aug. 23, 2018, 5:12 p.m.
Right Patch Set: Address PS3 Comment Created Aug. 24, 2018, 8:11 p.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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 compareFilter(test, "@@bla$~script,~other,~elemhide", ["type=whitelist", "text =@@bla$~script,~other,~elemhide", "regexp=bla", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]); 332 compareFilter(test, "@@bla$~script,~other,~elemhide", ["type=whitelist", "text =@@bla$~script,~other,~elemhide", "regexp=bla", "contentType=" + (defaultTypes & ~(t.SCRIPT | t.OTHER))]);
333 compareFilter(test, "@@bla$elemhide", ["type=whitelist", "text=@@bla$elemhide" , "regexp=bla", "contentType=" + t.ELEMHIDE]); 333 compareFilter(test, "@@bla$elemhide", ["type=whitelist", "text=@@bla$elemhide" , "regexp=bla", "contentType=" + t.ELEMHIDE]);
334 334
335 compareFilter(test, "@@bla$~script,~other,donottrack", ["type=invalid", "text= @@bla$~script,~other,donottrack", "reason=filter_unknown_option"]); 335 compareFilter(test, "@@bla$~script,~other,donottrack", ["type=invalid", "text= @@bla$~script,~other,donottrack", "reason=filter_unknown_option"]);
336 compareFilter(test, "@@bla$~script,~other,~donottrack", ["type=invalid", "text =@@bla$~script,~other,~donottrack", "reason=filter_unknown_option"]); 336 compareFilter(test, "@@bla$~script,~other,~donottrack", ["type=invalid", "text =@@bla$~script,~other,~donottrack", "reason=filter_unknown_option"]);
337 compareFilter(test, "@@bla$donottrack", ["type=invalid", "text=@@bla$donottrac k", "reason=filter_unknown_option"]); 337 compareFilter(test, "@@bla$donottrack", ["type=invalid", "text=@@bla$donottrac k", "reason=filter_unknown_option"]);
338 compareFilter(test, "@@bla$foobar", ["type=invalid", "text=@@bla$foobar", "rea son=filter_unknown_option"]); 338 compareFilter(test, "@@bla$foobar", ["type=invalid", "text=@@bla$foobar", "rea son=filter_unknown_option"]);
339 compareFilter(test, "@@bla$image,foobar", ["type=invalid", "text=@@bla$image,f oobar", "reason=filter_unknown_option"]); 339 compareFilter(test, "@@bla$image,foobar", ["type=invalid", "text=@@bla$image,f oobar", "reason=filter_unknown_option"]);
340 compareFilter(test, "@@bla$foobar,image", ["type=invalid", "text=@@bla$foobar, image", "reason=filter_unknown_option"]); 340 compareFilter(test, "@@bla$foobar,image", ["type=invalid", "text=@@bla$foobar, image", "reason=filter_unknown_option"]);
341 341
342 compareFilter(test, "bla$csp", ["type=invalid", "text=bla$csp", "reason=filter _invalid_csp"]);
342 compareFilter(test, "bla$csp=", ["type=invalid", "text=bla$csp=", "reason=filt er_invalid_csp"]); 343 compareFilter(test, "bla$csp=", ["type=invalid", "text=bla$csp=", "reason=filt er_invalid_csp"]);
Manish Jethani 2018/08/24 08:55:02 Let's also add a test for "bla$csp" (without the `
Jon Sonesen 2018/08/24 20:12:49 Done.
343 compareFilter(test, "bla$csp=report-uri", ["type=invalid", "text=bla$csp=repor t-uri", "reason=filter_invalid_csp"]); 344 compareFilter(test, "bla$csp=report-uri", ["type=invalid", "text=bla$csp=repor t-uri", "reason=filter_invalid_csp"]);
344 compareFilter(test, "bla$csp=foo,csp=report-to", ["type=invalid", "text=bla$cs p=foo,csp=report-to", "reason=filter_invalid_csp"]); 345 compareFilter(test, "bla$csp=foo,csp=report-to", ["type=invalid", "text=bla$cs p=foo,csp=report-to", "reason=filter_invalid_csp"]);
345 compareFilter(test, "bla$csp=foo,csp=referrer foo", ["type=invalid", "text=bla $csp=foo,csp=referrer foo", "reason=filter_invalid_csp"]); 346 compareFilter(test, "bla$csp=foo,csp=referrer foo", ["type=invalid", "text=bla $csp=foo,csp=referrer foo", "reason=filter_invalid_csp"]);
346 compareFilter(test, "bla$csp=foo,csp=base-uri", ["type=invalid", "text=bla$csp =foo,csp=base-uri", "reason=filter_invalid_csp"]); 347 compareFilter(test, "bla$csp=foo,csp=base-uri", ["type=invalid", "text=bla$csp =foo,csp=base-uri", "reason=filter_invalid_csp"]);
347 compareFilter(test, "bla$csp=foo,csp=upgrade-insecure-requests", ["type=invali d", "text=bla$csp=foo,csp=upgrade-insecure-requests", "reason=filter_invalid_csp "]); 348 compareFilter(test, "bla$csp=foo,csp=upgrade-insecure-requests", ["type=invali d", "text=bla$csp=foo,csp=upgrade-insecure-requests", "reason=filter_invalid_csp "]);
348 compareFilter(test, "bla$csp=foo,csp=ReFeRReR", ["type=invalid", "text=bla$csp =foo,csp=ReFeRReR", "reason=filter_invalid_csp"]); 349 compareFilter(test, "bla$csp=foo,csp=ReFeRReR", ["type=invalid", "text=bla$csp =foo,csp=ReFeRReR", "reason=filter_invalid_csp"]);
349 350
350 test.done(); 351 test.done();
351 }; 352 };
352 353
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 let filterStrip = Filter.fromText(rewriteStrip); 598 let filterStrip = Filter.fromText(rewriteStrip);
598 599
599 test.equal(filterStrip.rewrite, ""); 600 test.equal(filterStrip.rewrite, "");
600 test.equal( 601 test.equal(
601 filterStrip.rewriteUrl("http://example.com/?tag"), 602 filterStrip.rewriteUrl("http://example.com/?tag"),
602 "http://example.com/?" 603 "http://example.com/?"
603 ); 604 );
604 605
605 test.done(); 606 test.done();
606 }; 607 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld