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

Unified Diff: lib/hitLogger.js

Issue 29995566: Noissue - Avoid loop if DevTools is closed (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Feb. 2, 2019, 4:14 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/hitLogger.js
===================================================================
--- a/lib/hitLogger.js
+++ b/lib/hitLogger.js
@@ -84,18 +84,21 @@
* The active sitekey if there is any
* @param {?boolean} request.specificOnly
* Whether generic filters should be ignored
* @param {?BlockingFilter} filter
* The matched filter or null if there is no match
*/
exports.logRequest = (tabIds, request, filter) =>
{
- for (let tabId of tabIds)
- eventEmitter.emit(tabId, request, filter);
+ if (eventEmitter.hasListeners())
+ {
+ for (let tabId of tabIds)
+ eventEmitter.emit(tabId, request, filter);
+ }
};
/**
* Logs active element hiding filters for a tab.
*
* @param {number} tabId The ID of the tab, the elements were hidden in
* @param {string[]} selectors The selectors of applied ElemHideFilters
* @param {string[]} filters The text of applied ElemHideEmulationFilters
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld