LEFT | RIGHT |
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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 test.equal(Filter.normalize("||content.server.com/files/*.php$rewrite= $1"), | 557 test.equal(Filter.normalize("||content.server.com/files/*.php$rewrite= $1"), |
558 "||content.server.com/files/*.php$rewrite=$1"); | 558 "||content.server.com/files/*.php$rewrite=$1"); |
559 test.done(); | 559 test.done(); |
560 }; | 560 }; |
561 | 561 |
562 exports.testFilterRewriteOption = function(test) | 562 exports.testFilterRewriteOption = function(test) |
563 { | 563 { |
564 let text = "/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=$1"; | 564 let text = "/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=$1"; |
565 let filter = Filter.fromText(text); | 565 let filter = Filter.fromText(text); |
566 test.ok(filter instanceof InvalidFilter); | 566 test.ok(filter instanceof InvalidFilter); |
| 567 test.equal(filter.type, "invalid"); |
| 568 test.equal(filter.reason, "filter_invalid_rewrite"); |
567 | 569 |
568 text = "||/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=blank-text,doma
ins=content.server"; | 570 text = "||/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=blank-text,doma
ins=content.server"; |
569 filter = Filter.fromText(text); | 571 filter = Filter.fromText(text); |
570 test.ok(filter instanceof InvalidFilter); | 572 test.ok(filter instanceof InvalidFilter); |
| 573 test.equal(filter.type, "invalid"); |
| 574 test.equal(filter.reason, "filter_invalid_rewrite"); |
571 | 575 |
572 text = "||/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=abp-resource:bl
ank-text,domain=content.server"; | 576 text = "||/(content\\.server\\/file\\/.*\\.txt)\\?.*$/$rewrite=abp-resource:bl
ank-text,domain=content.server"; |
573 filter = Filter.fromText(text); | 577 filter = Filter.fromText(text); |
574 test.equal(filter.rewriteUrl("http://content.server/file/foo.txt"), | 578 test.equal(filter.rewriteUrl("http://content.server/file/foo.txt"), |
575 "data:text/plain,"); | 579 "data:text/plain,"); |
576 test.equal(filter.rewriteUrl("http://content.server/file/foo.txt?bar"), | 580 test.equal(filter.rewriteUrl("http://content.server/file/foo.txt?bar"), |
577 "data:text/plain,"); | 581 "data:text/plain,"); |
578 | 582 |
579 test.done(); | 583 test.done(); |
580 }; | 584 }; |
(...skipping 20 matching lines...) Expand all Loading... |
601 | 605 |
602 test.notEqual(filter2.domains, filter5.domains); | 606 test.notEqual(filter2.domains, filter5.domains); |
603 | 607 |
604 // Check twice for element hiding filters to make sure the internal cached | 608 // Check twice for element hiding filters to make sure the internal cached |
605 // values are also not equal. | 609 // values are also not equal. |
606 test.notEqual(filter4.domains, filter6.domains); | 610 test.notEqual(filter4.domains, filter6.domains); |
607 test.notEqual(filter4.domains, filter6.domains); | 611 test.notEqual(filter4.domains, filter6.domains); |
608 | 612 |
609 test.done(); | 613 test.done(); |
610 }; | 614 }; |
LEFT | RIGHT |