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: Created April 2, 2018, 12:27 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
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++;
kzar 2018/04/03 17:14:03 Seems like before we didn't increment this counter
Sebastian Noack 2018/04/04 01:50:33 Yes. To me it seems a mistake that we didn't befor
-
- 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", () =>
« lib/requestBlocker.js ('K') | « lib/requestBlocker.js ('k') | lib/whitelisting.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld