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

Side by Side Diff: test/filterClasses.js

Issue 29806570: Noissue - Add a test to confirm an evil rewrite gets cancelled (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 13, 2018, 4:46 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 | « no previous file | 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-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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 test.equal( 540 test.equal(
541 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"), 541 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"),
542 "http://content.server/file/foo.txt/disable" 542 "http://content.server/file/foo.txt/disable"
543 ); 543 );
544 test.equal( 544 test.equal(
545 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"), 545 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"),
546 "http://example.com/file/foo.txt/disable" 546 "http://example.com/file/foo.txt/disable"
547 ); 547 );
548 548
549 // Example from https://github.com/uBlockOrigin/uBlock-issues/issues/46#issuec omment-391190533
550 // The rewrite shouldn't happen.
551 let rewriteEvil = "/(^https?:\\/\\/[^/])/$script,rewrite=$1.evil.com";
552 let filterEvil = Filter.fromText(rewriteEvil);
553
554 test.equal(
555 filterEvil.rewriteUrl("https://www.adblockplus.org/script.js"),
556 "https://www.adblockplus.org/script.js"
557 );
558
549 test.done(); 559 test.done();
550 }; 560 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld