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

Side by Side Diff: lib/filterClasses.js

Issue 29892582: Noissue - Use Array.prototype.includes in isActiveOnDomain (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 26, 2018, 9:06 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 * @param {string} [docDomain] domain name of the document that loads the URL 525 * @param {string} [docDomain] domain name of the document that loads the URL
526 * @param {string} [sitekey] public key provided by the document 526 * @param {string} [sitekey] public key provided by the document
527 * @return {boolean} true in case of the filter being active 527 * @return {boolean} true in case of the filter being active
528 */ 528 */
529 isActiveOnDomain(docDomain, sitekey) 529 isActiveOnDomain(docDomain, sitekey)
530 { 530 {
531 // Sitekeys are case-sensitive so we shouldn't convert them to 531 // Sitekeys are case-sensitive so we shouldn't convert them to
532 // upper-case to avoid false positives here. Instead we need to 532 // upper-case to avoid false positives here. Instead we need to
533 // change the way filter options are parsed. 533 // change the way filter options are parsed.
534 if (this.sitekeys && 534 if (this.sitekeys &&
535 (!sitekey || this.sitekeys.indexOf(sitekey.toUpperCase()) < 0)) 535 (!sitekey || !this.sitekeys.includes(sitekey.toUpperCase())))
536 { 536 {
537 return false; 537 return false;
538 } 538 }
539 539
540 let {domains} = this; 540 let {domains} = this;
541 541
542 // If no domains are set the rule matches everywhere 542 // If no domains are set the rule matches everywhere
543 if (!domains) 543 if (!domains)
544 return true; 544 return true;
545 545
(...skipping 685 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 | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld