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

Side by Side Diff: lib/filterClasses.js

Issue 29870574: Noissue - Define RegExpFilter's 0 getter statically (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 1, 2018, 3:05 a.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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 exports.RegExpFilter = RegExpFilter; 619 exports.RegExpFilter = RegExpFilter;
620 620
621 RegExpFilter.prototype = extend(ActiveFilter, { 621 RegExpFilter.prototype = extend(ActiveFilter, {
622 /** 622 /**
623 * @see ActiveFilter.domainSourceIsLowerCase 623 * @see ActiveFilter.domainSourceIsLowerCase
624 */ 624 */
625 domainSourceIsLowerCase: true, 625 domainSourceIsLowerCase: true,
626 626
627 /** 627 /**
628 * Number of filters contained, will always be 1 (required to 628 * Number of filters contained, will always be 1 (required to
629 * optimize Matcher). 629 * optimize {@link Matcher}).
630 * @type {number} 630 * @type {number}
631 */ 631 */
632 length: 1, 632 length: 1,
633 633
634 /** 634 /**
635 * The filter itself (required to optimize {@link Matcher}).
636 * @type {RegExpFilter}
637 */
638 get 0()
639 {
640 return this;
641 },
642
643 /**
635 * @see ActiveFilter.domainSeparator 644 * @see ActiveFilter.domainSeparator
636 */ 645 */
637 domainSeparator: "|", 646 domainSeparator: "|",
638 647
639 /** 648 /**
640 * Expression from which a regular expression should be generated - 649 * Expression from which a regular expression should be generated -
641 * for delayed creation of the regexp property 650 * for delayed creation of the regexp property
642 * @type {string} 651 * @type {string}
643 */ 652 */
644 regexpSource: null, 653 regexpSource: null,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 if (this.contentType & typeMask && 722 if (this.contentType & typeMask &&
714 (this.thirdParty == null || this.thirdParty == thirdParty) && 723 (this.thirdParty == null || this.thirdParty == thirdParty) &&
715 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location)) 724 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location))
716 { 725 {
717 return true; 726 return true;
718 } 727 }
719 return false; 728 return false;
720 } 729 }
721 }); 730 });
722 731
723 // Required to optimize Matcher, see also RegExpFilter.prototype.length
724 Object.defineProperty(RegExpFilter.prototype, "0", {
725 get() { return this; }
726 });
727
728 /** 732 /**
729 * Creates a RegExp filter from its text representation 733 * Creates a RegExp filter from its text representation
730 * @param {string} text same as in Filter() 734 * @param {string} text same as in Filter()
731 * @return {Filter} 735 * @return {Filter}
732 */ 736 */
733 RegExpFilter.fromText = function(text) 737 RegExpFilter.fromText = function(text)
734 { 738 {
735 let blocking = true; 739 let blocking = true;
736 let origText = text; 740 let origText = text;
737 if (text[0] == "@" && text[1] == "@") 741 if (text[0] == "@" && text[1] == "@")
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 1181
1178 /** 1182 /**
1179 * Script that should be executed 1183 * Script that should be executed
1180 * @type {string} 1184 * @type {string}
1181 */ 1185 */
1182 get script() 1186 get script()
1183 { 1187 {
1184 return this.body; 1188 return this.body;
1185 } 1189 }
1186 }); 1190 });
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