| Left: | ||
| Right: |
| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 * letters | 618 * letters |
| 619 * @param {string} [domains] | 619 * @param {string} [domains] |
| 620 * Domains that the filter is restricted to, e.g. "foo.com|bar.com|~baz.com" | 620 * Domains that the filter is restricted to, e.g. "foo.com|bar.com|~baz.com" |
| 621 * @param {boolean} [thirdParty] | 621 * @param {boolean} [thirdParty] |
| 622 * Defines whether the filter should apply to third-party or first-party | 622 * Defines whether the filter should apply to third-party or first-party |
| 623 * content only | 623 * content only |
| 624 * @param {string} [sitekeys] | 624 * @param {string} [sitekeys] |
| 625 * Public keys of websites that this filter should apply to | 625 * Public keys of websites that this filter should apply to |
| 626 * @param {?string} [rewrite] | 626 * @param {?string} [rewrite] |
| 627 * The name of the internal resource to which to rewrite the | 627 * The name of the internal resource to which to rewrite the |
| 628 * URL. e.g. if the value of the <code>rewrite</code> parameter is | 628 * URL. e.g. if the value of the <code>$rewrite</code> option is |
| 629 * <code>abp-resource:blank-html</code>, this should be | 629 * <code>abp-resource:blank-html</code>, this should be |
| 630 * <code>blank-html</code>. | 630 * <code>blank-html</code>. |
| 631 * @constructor | 631 * @constructor |
| 632 * @augments ActiveFilter | 632 * @augments ActiveFilter |
| 633 */ | 633 */ |
| 634 function RegExpFilter(text, regexpSource, contentType, matchCase, domains, | 634 function RegExpFilter(text, regexpSource, contentType, matchCase, domains, |
| 635 thirdParty, sitekeys, rewrite) | 635 thirdParty, sitekeys, rewrite) |
| 636 { | 636 { |
| 637 ActiveFilter.call(this, text, domains); | 637 ActiveFilter.call(this, text, domains); |
| 638 | 638 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 /** | 695 /** |
| 696 * Regular expression to be used when testing against this filter | 696 * Regular expression to be used when testing against this filter |
| 697 * @type {RegExp} | 697 * @type {RegExp} |
| 698 */ | 698 */ |
| 699 get regexp() | 699 get regexp() |
| 700 { | 700 { |
| 701 let value = null; | 701 let value = null; |
| 702 | 702 |
| 703 let {pattern} = this; | 703 let {pattern} = this; |
| 704 if (!isLiteralPattern(pattern)) | 704 if (!isLiteralPattern(pattern)) |
| 705 value = new RegExp(filterToRegExp(pattern)); | 705 value = new RegExp(filterToRegExp(pattern)); |
|
hub
2019/04/16 13:44:27
There was a conflict here (removal of the last arg
Manish Jethani
2019/04/16 14:06:23
Acknowledged.
| |
| 706 | 706 |
| 707 Object.defineProperty(this, "regexp", {value}); | 707 Object.defineProperty(this, "regexp", {value}); |
| 708 return value; | 708 return value; |
| 709 }, | 709 }, |
| 710 /** | 710 /** |
| 711 * Content types the filter applies to, combination of values from | 711 * Content types the filter applies to, combination of values from |
| 712 * RegExpFilter.typeMap | 712 * RegExpFilter.typeMap |
| 713 * @type {number} | 713 * @type {number} |
| 714 */ | 714 */ |
| 715 contentType: 0x7FFFFFFF, | 715 contentType: 0x7FFFFFFF, |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 case "sitekey": | 953 case "sitekey": |
| 954 if (!value) | 954 if (!value) |
| 955 return new InvalidFilter(origText, "filter_unknown_option"); | 955 return new InvalidFilter(origText, "filter_unknown_option"); |
| 956 sitekeys = value.toUpperCase(); | 956 sitekeys = value.toUpperCase(); |
| 957 break; | 957 break; |
| 958 case "rewrite": | 958 case "rewrite": |
| 959 if (value == null) | 959 if (value == null) |
| 960 return new InvalidFilter(origText, "filter_unknown_option"); | 960 return new InvalidFilter(origText, "filter_unknown_option"); |
| 961 if (!value.startsWith("abp-resource:")) | 961 if (!value.startsWith("abp-resource:")) |
| 962 return new InvalidFilter(origText, "filter_invalid_rewrite"); | 962 return new InvalidFilter(origText, "filter_invalid_rewrite"); |
| 963 rewrite = value.substring("abp-resource:".length); | 963 rewrite = value.substring("abp-resource:".length); |
|
hub
2019/04/16 13:44:27
There was another conflict here. We changed from s
Manish Jethani
2019/04/16 14:06:23
Acknowledged.
| |
| 964 break; | 964 break; |
| 965 default: | 965 default: |
| 966 return new InvalidFilter(origText, "filter_unknown_option"); | 966 return new InvalidFilter(origText, "filter_unknown_option"); |
| 967 } | 967 } |
| 968 } | 968 } |
| 969 } | 969 } |
| 970 } | 970 } |
| 971 | 971 |
| 972 try | 972 try |
| 973 { | 973 { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1050 * Class for blocking filters | 1050 * Class for blocking filters |
| 1051 * @param {string} text see {@link Filter Filter()} | 1051 * @param {string} text see {@link Filter Filter()} |
| 1052 * @param {string} regexpSource see {@link RegExpFilter RegExpFilter()} | 1052 * @param {string} regexpSource see {@link RegExpFilter RegExpFilter()} |
| 1053 * @param {number} [contentType] see {@link RegExpFilter RegExpFilter()} | 1053 * @param {number} [contentType] see {@link RegExpFilter RegExpFilter()} |
| 1054 * @param {boolean} [matchCase] see {@link RegExpFilter RegExpFilter()} | 1054 * @param {boolean} [matchCase] see {@link RegExpFilter RegExpFilter()} |
| 1055 * @param {string} [domains] see {@link RegExpFilter RegExpFilter()} | 1055 * @param {string} [domains] see {@link RegExpFilter RegExpFilter()} |
| 1056 * @param {boolean} [thirdParty] see {@link RegExpFilter RegExpFilter()} | 1056 * @param {boolean} [thirdParty] see {@link RegExpFilter RegExpFilter()} |
| 1057 * @param {string} [sitekeys] see {@link RegExpFilter RegExpFilter()} | 1057 * @param {string} [sitekeys] see {@link RegExpFilter RegExpFilter()} |
| 1058 * @param {?string} [rewrite] | 1058 * @param {?string} [rewrite] |
| 1059 * The name of the internal resource to which to rewrite the | 1059 * The name of the internal resource to which to rewrite the |
| 1060 * URL. e.g. if the value of the <code>rewrite</code> parameter is | 1060 * URL. e.g. if the value of the <code>$rewrite</code> option is |
|
Manish Jethani
2019/04/16 13:54:06
We forgot this in master but let's do it here: $re
hub
2019/04/16 14:08:39
The function docs didn't get that fix. Doing both.
| |
| 1061 * <code>abp-resource:blank-html</code>, this should be | 1061 * <code>abp-resource:blank-html</code>, this should be |
| 1062 * <code>blank-html</code>. | 1062 * <code>blank-html</code>. |
| 1063 * @param {boolean} [collapse] | 1063 * @param {boolean} [collapse] |
| 1064 * defines whether the filter should collapse blocked content, can be null | 1064 * defines whether the filter should collapse blocked content, can be null |
| 1065 * @param {string} [csp] | 1065 * @param {string} [csp] |
| 1066 * Content Security Policy to inject when the filter matches | 1066 * Content Security Policy to inject when the filter matches |
| 1067 * @constructor | 1067 * @constructor |
| 1068 * @augments RegExpFilter | 1068 * @augments RegExpFilter |
| 1069 */ | 1069 */ |
| 1070 function BlockingFilter(text, regexpSource, contentType, matchCase, domains, | 1070 function BlockingFilter(text, regexpSource, contentType, matchCase, domains, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1312 | 1312 |
| 1313 /** | 1313 /** |
| 1314 * Script that should be executed | 1314 * Script that should be executed |
| 1315 * @type {string} | 1315 * @type {string} |
| 1316 */ | 1316 */ |
| 1317 get script() | 1317 get script() |
| 1318 { | 1318 { |
| 1319 return this.body; | 1319 return this.body; |
| 1320 } | 1320 } |
| 1321 }); | 1321 }); |
| LEFT | RIGHT |