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

Unified Diff: lib/stats.js

Issue 29737602: Issue 4580 - Make filter/request logging use plain tabIds, prepare for multi-tab requests (Closed)
Patch Set: Removed outdated comment Created April 4, 2018, 1:48 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 | « lib/requestBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/stats.js
===================================================================
--- a/lib/stats.js
+++ b/lib/stats.js
@@ -53,24 +53,28 @@
}
});
-FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) =>
+FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, tabIds) =>
{
- if (!(filter instanceof BlockingFilter) || !page)
+ if (!(filter instanceof BlockingFilter))
return;
+ for (let tabId of tabIds)
+ {
+ let page = new ext.Page({id: tabId});
+ let blocked = blockedPerPage.get(page) || 0;
+ blockedPerPage.set(page, ++blocked);
+
+ // Update number in icon
+ if (Prefs.show_statsinicon)
+ {
+ page.browserAction.setBadge({
+ color: badgeColor,
+ number: blocked
+ });
+ }
+ }
+
Prefs.blocked_total++;
-
- let blocked = blockedPerPage.get(page) || 0;
- blockedPerPage.set(page, ++blocked);
-
- // Update number in icon
- if (Prefs.show_statsinicon)
- {
- page.browserAction.setBadge({
- color: badgeColor,
- number: blocked
- });
- }
});
Prefs.on("show_statsinicon", () =>
« no previous file with comments | « lib/requestBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld