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

Side by Side Diff: lib/filterComposer.js

Issue 29522601: Noissue - Use includes instead of indexOf (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Aug. 21, 2017, 11:16 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 | « lib/devtools.js ('k') | lib/notificationHelper.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 getKey(page, frame), specificOnly 111 getKey(page, frame), specificOnly
112 ); 112 );
113 113
114 if (!filter) 114 if (!filter)
115 { 115 {
116 let filterText = url.replace(/^[\w-]+:\/+(?:www\.)?/, "||"); 116 let filterText = url.replace(/^[\w-]+:\/+(?:www\.)?/, "||");
117 117
118 if (specificOnly) 118 if (specificOnly)
119 filterText += "$domain=" + docDomain; 119 filterText += "$domain=" + docDomain;
120 120
121 if (filters.indexOf(filterText) == -1) 121 if (!filters.includes(filterText))
122 filters.push(filterText); 122 filters.push(filterText);
123 } 123 }
124 } 124 }
125 125
126 // If we couldn't generate any blocking filters, fallback to element hiding 126 // If we couldn't generate any blocking filters, fallback to element hiding
127 if (filters.length == 0 && !checkWhitelisted(page, frame, 127 if (filters.length == 0 && !checkWhitelisted(page, frame,
128 RegExpFilter.typeMap.ELEMHIDE)) 128 RegExpFilter.typeMap.ELEMHIDE))
129 { 129 {
130 // Generate CSS selectors based on the element's "id" and 130 // Generate CSS selectors based on the element's "id" and
131 // "class" attribute. 131 // "class" attribute.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 port.on("composer.quoteCSS", (message, sender) => 252 port.on("composer.quoteCSS", (message, sender) =>
253 { 253 {
254 return quoteCSS(message.CSS); 254 return quoteCSS(message.CSS);
255 }); 255 });
256 256
257 ext.pages.onLoading.addListener(page => 257 ext.pages.onLoading.addListener(page =>
258 { 258 {
259 page.sendMessage({type: "composer.content.finished"}); 259 page.sendMessage({type: "composer.content.finished"});
260 }); 260 });
OLDNEW
« no previous file with comments | « lib/devtools.js ('k') | lib/notificationHelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld