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

Side by Side Diff: lib/filterClasses.js

Issue 29907586: Issue 6994 - Use shortcut matching for location only filters (Closed)
Patch Set: Address PS4, and rebase Created Oct. 24, 2018, 8:40 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 | lib/matcher.js » ('j') | lib/matcher.js » ('J')
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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 this.sitekeySource = null; 801 this.sitekeySource = null;
802 } 802 }
803 803
804 Object.defineProperty( 804 Object.defineProperty(
805 this, "sitekeys", {value: sitekeys, enumerable: true} 805 this, "sitekeys", {value: sitekeys, enumerable: true}
806 ); 806 );
807 return this.sitekeys; 807 return this.sitekeys;
808 }, 808 },
809 809
810 /** 810 /**
811 * Tests whether the filter only has a location.
812 * @return {boolean}
813 */
814 isLocationOnly()
815 {
816 return this.contentType == RegExpFilter.prototype.contentType &&
Manish Jethani 2018/10/24 21:35:28 I haven't run this code, but I'm pretty sure that
Jon Sonesen 2018/10/24 21:46:51 Ah, I see what you mean there. I didn't look deep
817 this.thirdParty == null && !this.domains && !this.sitekeys;
818 },
819
820 /**
811 * Tests whether the URL matches this filter 821 * Tests whether the URL matches this filter
812 * @param {string} location URL to be tested 822 * @param {string} location URL to be tested
813 * @param {number} typeMask bitmask of content / request types to match 823 * @param {number} typeMask bitmask of content / request types to match
814 * @param {string} [docDomain] domain name of the document that loads the URL 824 * @param {string} [docDomain] domain name of the document that loads the URL
815 * @param {boolean} [thirdParty] should be true if the URL is a third-party 825 * @param {boolean} [thirdParty] should be true if the URL is a third-party
816 * request 826 * request
817 * @param {string} [sitekey] public key provided by the document 827 * @param {string} [sitekey] public key provided by the document
818 * @return {boolean} true in case of a match 828 * @return {boolean} true in case of a match
819 */ 829 */
820 matches(location, typeMask, docDomain, thirdParty, sitekey) 830 matches(location, typeMask, docDomain, thirdParty, sitekey)
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 1350
1341 /** 1351 /**
1342 * Script that should be executed 1352 * Script that should be executed
1343 * @type {string} 1353 * @type {string}
1344 */ 1354 */
1345 get script() 1355 get script()
1346 { 1356 {
1347 return this.body; 1357 return this.body;
1348 } 1358 }
1349 }); 1359 });
OLDNEW
« no previous file with comments | « no previous file | lib/matcher.js » ('j') | lib/matcher.js » ('J')

Powered by Google App Engine
This is Rietveld