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

Delta Between Two Patch Sets: lib/stats.js

Issue 29532767: Issue 5593 - Use messaging in popup for prefs, whitelisting, and stats (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Change whitelisting calls to use messaging Created Sept. 21, 2017, 7:54 a.m.
Right Patch Set: Revert one more instance of ext.pages.open Created Sept. 27, 2017, 9:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterComposer.js ('k') | lib/whitelisting.js » ('j') | stats.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 23 matching lines...) Expand all
34 * @param {Page} page 34 * @param {Page} page
35 * @return {Number} 35 * @return {Number}
36 */ 36 */
37 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; 37 exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0;
38 38
39 // Chrome automatically clears the browser action badge text when the URL of 39 // Chrome automatically clears the browser action badge text when the URL of
40 // the tab is updated, but Firefox doesn't. 40 // the tab is updated, but Firefox doesn't.
41 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395074 41 // https://bugzilla.mozilla.org/show_bug.cgi?id=1395074
42 ext.pages.onLoading.addListener(page => 42 ext.pages.onLoading.addListener(page =>
43 { 43 {
44 page.browserAction.setBadge(); 44 if (!blockedPerPage.get(page))
45 page.browserAction.setBadge();
45 }); 46 });
46 47
47 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => 48 FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) =>
48 { 49 {
49 if (!(filter instanceof BlockingFilter) || !page) 50 if (!(filter instanceof BlockingFilter) || !page)
50 return; 51 return;
51 52
52 Prefs.blocked_total++; 53 Prefs.blocked_total++;
53 54
54 let blocked = blockedPerPage.get(page) || 0; 55 let blocked = blockedPerPage.get(page) || 0;
(...skipping 29 matching lines...) Expand all
84 } 85 }
85 } 86 }
86 87
87 page.browserAction.setBadge(badge); 88 page.browserAction.setBadge(badge);
88 } 89 }
89 }); 90 });
90 }); 91 });
91 92
92 port.on("stats.getBlockedPerPage", 93 port.on("stats.getBlockedPerPage",
93 message => getBlockedPerPage(new ext.Page(message.tab))); 94 message => getBlockedPerPage(new ext.Page(message.tab)));
LEFTRIGHT

Powered by Google App Engine
This is Rietveld