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

Unified Diff: lib/devtools.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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ext/background.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/devtools.js
===================================================================
--- a/lib/devtools.js
+++ b/lib/devtools.js
@@ -270,37 +270,37 @@
// If an added filter matches a request shown in the devtools panel,
// update that record to show the new filter. Ignore filters that aren't
// associated with any sub-resource request. There is no record for these
// if they don't already match. In particular, in case of element hiding
// filters, we also wouldn't know if any new element matches.
if (added)
{
- if (nonRequestTypes.indexOf(record.request.type) != -1)
+ if (nonRequestTypes.includes(record.request.type))
continue;
let filter = matchRequest(record.request);
- if (filters.indexOf(filter) == -1)
+ if (!filters.includes(filter))
continue;
record.filter = filter;
}
// If a filter shown in the devtools panel got removed, update that
// record to show the filter that matches now, or none, instead.
// For filters that aren't associated with any sub-resource request,
// just remove the record. We wouldn't know whether another filter
// matches instead until the page is reloaded.
else
{
- if (filters.indexOf(record.filter) == -1)
+ if (!filters.includes(record.filter))
continue;
- if (nonRequestTypes.indexOf(record.request.type) != -1)
+ if (nonRequestTypes.includes(record.request.type))
{
panel.port.postMessage({
type: "remove-record",
index: i
});
panel.records.splice(i--, 1);
continue;
}
« no previous file with comments | « ext/background.js ('k') | lib/filterComposer.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld