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

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29746563: Noissue - Trim spaces around element hiding emulation selectors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Revert Patch Set 3 Created April 11, 2018, 5:30 p.m.
Right Patch Set: Add tests for incorrect syntax Created April 18, 2018, 12:41 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 "! fo o## bar"); 428 "! fo o## bar");
429 429
430 // Element hiding filters 430 // Element hiding filters
431 test.equal(Filter.normalize(" domain.c om## # sele ctor "), 431 test.equal(Filter.normalize(" domain.c om## # sele ctor "),
432 "domain.com### sele ctor"); 432 "domain.com### sele ctor");
433 433
434 // Element hiding emulation filters 434 // Element hiding emulation filters
435 test.equal(Filter.normalize(" domain.c om#?# # sele ctor "), 435 test.equal(Filter.normalize(" domain.c om#?# # sele ctor "),
436 "domain.com#?## sele ctor"); 436 "domain.com#?## sele ctor");
437 437
438 // Incorrect syntax: the separator "#?#" cannot contain spaces; treated as a
439 // regular filter instead
440 test.equal(Filter.normalize(" domain.c om# ?#. sele ctor "),
441 "domain.com#?#.selector");
442 // Incorrect syntax: the separator "#?#" cannot contain spaces; treated as an
443 // element hiding filter instead, because the "##" following the "?" is taken
444 // to be the separator instead
445 test.equal(Filter.normalize(" domain.c om# ?##sele ctor "),
446 "domain.com#?##sele ctor");
447
438 // Element hiding exception filters 448 // Element hiding exception filters
439 test.equal(Filter.normalize(" domain.c om#@# # sele ctor "), 449 test.equal(Filter.normalize(" domain.c om#@# # sele ctor "),
440 "domain.com#@## sele ctor"); 450 "domain.com#@## sele ctor");
451
452 // Incorrect syntax: the separator "#@#" cannot contain spaces; treated as a
453 // regular filter instead (not an element hiding filter either!), because
454 // unlike the case with "# ?##" the "##" following the "@" is not considered
455 // to be a separator
456 test.equal(Filter.normalize(" domain.c om# @## sele ctor "),
457 "domain.com#@##selector");
441 458
442 // Regular filters 459 // Regular filters
443 let normalized = Filter.normalize( 460 let normalized = Filter.normalize(
444 " b$l a$sitekey= foo ,domain= do main.com |foo .com,c sp= c s p " 461 " b$l a$sitekey= foo ,domain= do main.com |foo .com,c sp= c s p "
445 ); 462 );
446 test.equal( 463 test.equal(
447 normalized, 464 normalized,
448 "b$la$sitekey=foo,domain=domain.com|foo.com,csp=c s p" 465 "b$la$sitekey=foo,domain=domain.com|foo.com,csp=c s p"
449 ); 466 );
450 compareFilter( 467 compareFilter(
(...skipping 25 matching lines...) Expand all
476 "foo$csp=bar,$csp=c s p"); 493 "foo$csp=bar,$csp=c s p");
477 test.equal(Filter.normalize(" f o o $ bar $csp=ba r"), 494 test.equal(Filter.normalize(" f o o $ bar $csp=ba r"),
478 "foo$bar$csp=ba r"); 495 "foo$bar$csp=ba r");
479 test.equal(Filter.normalize("f $ o $ o $ csp=f o o "), 496 test.equal(Filter.normalize("f $ o $ o $ csp=f o o "),
480 "f$o$o$csp=f o o"); 497 "f$o$o$csp=f o o");
481 test.equal(Filter.normalize("/foo$/$ csp = script-src http://example.com/?$1= 1&$2=2&$3=3"), 498 test.equal(Filter.normalize("/foo$/$ csp = script-src http://example.com/?$1= 1&$2=2&$3=3"),
482 "/foo$/$csp=script-src http://example.com/?$1=1&$2=2&$3=3"); 499 "/foo$/$csp=script-src http://example.com/?$1=1&$2=2&$3=3");
483 500
484 test.done(); 501 test.done();
485 }; 502 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld