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

Side by Side Diff: lib/filterClasses.js

Issue 29874561: Noissue - Return value of filter match expression directly (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 4, 2018, 1:44 p.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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 * @param {string} location URL to be tested 712 * @param {string} location URL to be tested
713 * @param {number} typeMask bitmask of content / request types to match 713 * @param {number} typeMask bitmask of content / request types to match
714 * @param {string} [docDomain] domain name of the document that loads the URL 714 * @param {string} [docDomain] domain name of the document that loads the URL
715 * @param {boolean} [thirdParty] should be true if the URL is a third-party 715 * @param {boolean} [thirdParty] should be true if the URL is a third-party
716 * request 716 * request
717 * @param {string} [sitekey] public key provided by the document 717 * @param {string} [sitekey] public key provided by the document
718 * @return {boolean} true in case of a match 718 * @return {boolean} true in case of a match
719 */ 719 */
720 matches(location, typeMask, docDomain, thirdParty, sitekey) 720 matches(location, typeMask, docDomain, thirdParty, sitekey)
721 { 721 {
722 if (this.contentType & typeMask && 722 return (this.contentType & typeMask) != 0 &&
Manish Jethani 2018/09/04 13:46:06 The first condition here needs to evaluate to a bo
Jon Sonesen 2018/09/05 14:16:38 Yeah, I see what you did there. Stylistically I pr
723 (this.thirdParty == null || this.thirdParty == thirdParty) && 723 (this.thirdParty == null || this.thirdParty == thirdParty) &&
724 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location)) 724 this.isActiveOnDomain(docDomain, sitekey) &&
725 { 725 this.regexp.test(location);
726 return true;
727 }
728 return false;
729 } 726 }
730 }); 727 });
731 728
732 /** 729 /**
733 * Creates a RegExp filter from its text representation 730 * Creates a RegExp filter from its text representation
734 * @param {string} text same as in Filter() 731 * @param {string} text same as in Filter()
735 * @return {Filter} 732 * @return {Filter}
736 */ 733 */
737 RegExpFilter.fromText = function(text) 734 RegExpFilter.fromText = function(text)
738 { 735 {
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 1178
1182 /** 1179 /**
1183 * Script that should be executed 1180 * Script that should be executed
1184 * @type {string} 1181 * @type {string}
1185 */ 1182 */
1186 get script() 1183 get script()
1187 { 1184 {
1188 return this.body; 1185 return this.body;
1189 } 1186 }
1190 }); 1187 });
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