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

Side by Side Diff: lib/filterClasses.js

Issue 29892596: Issue 6992 - Remove keyword-by-filter map (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Implement faster version of isSlowFilter Created Sept. 28, 2018, 9:22 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 | lib/matcher.js » ('j') | 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 675 }
676 } 676 }
677 exports.RegExpFilter = RegExpFilter; 677 exports.RegExpFilter = RegExpFilter;
678 678
679 RegExpFilter.prototype = extend(ActiveFilter, { 679 RegExpFilter.prototype = extend(ActiveFilter, {
680 /** 680 /**
681 * Number of filters contained, will always be 1 (required to 681 * Number of filters contained, will always be 1 (required to
682 * optimize {@link Matcher}). 682 * optimize {@link Matcher}).
683 * @type {number} 683 * @type {number}
684 */ 684 */
685 length: 1, 685 size: 1,
686
687 /**
688 * The filter itself (required to optimize {@link Matcher}).
689 * @type {RegExpFilter}
690 */
691 get 0()
692 {
693 return this;
694 },
695 686
696 /** 687 /**
697 * @see ActiveFilter.domainSeparator 688 * @see ActiveFilter.domainSeparator
698 */ 689 */
699 domainSeparator: "|", 690 domainSeparator: "|",
700 691
701 /** 692 /**
702 * Expression from which a regular expression should be generated - 693 * Expression from which a regular expression should be generated -
703 * for delayed creation of the regexp property 694 * for delayed creation of the regexp property
704 * @type {?string} 695 * @type {?string}
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 matches(location, typeMask, docDomain, thirdParty, sitekey) 763 matches(location, typeMask, docDomain, thirdParty, sitekey)
773 { 764 {
774 return (this.contentType & typeMask) != 0 && 765 return (this.contentType & typeMask) != 0 &&
775 (this.thirdParty == null || this.thirdParty == thirdParty) && 766 (this.thirdParty == null || this.thirdParty == thirdParty) &&
776 this.isActiveOnDomain(docDomain, sitekey) && 767 this.isActiveOnDomain(docDomain, sitekey) &&
777 this.regexp.test(location); 768 this.regexp.test(location);
778 } 769 }
779 }); 770 });
780 771
781 /** 772 /**
773 * Yields the filter itself (required to optimize {@link Matcher}).
774 * @yields {RegExpFilter}
775 */
776 RegExpFilter.prototype[Symbol.iterator] = function*()
777 {
778 yield this;
779 };
780
781 /**
782 * Creates a RegExp filter from its text representation 782 * Creates a RegExp filter from its text representation
783 * @param {string} text same as in Filter() 783 * @param {string} text same as in Filter()
784 * @return {Filter} 784 * @return {Filter}
785 */ 785 */
786 RegExpFilter.fromText = function(text) 786 RegExpFilter.fromText = function(text)
787 { 787 {
788 let blocking = true; 788 let blocking = true;
789 let origText = text; 789 let origText = text;
790 if (text[0] == "@" && text[1] == "@") 790 if (text[0] == "@" && text[1] == "@")
791 { 791 {
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 /** 1232 /**
1233 * Script that should be executed 1233 * Script that should be executed
1234 * @type {string} 1234 * @type {string}
1235 */ 1235 */
1236 get script() 1236 get script()
1237 { 1237 {
1238 return this.body; 1238 return this.body;
1239 } 1239 }
1240 }); 1240 });
OLDNEW
« no previous file with comments | « no previous file | lib/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld