OLD | NEW |
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 Loading... |
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 }; |
OLD | NEW |