Index: lib/stats.js |
diff --git a/lib/stats.js b/lib/stats.js |
index f64c2cee9f5835610f8e08da253473a32ea9c895..ae586b8f0989cc15b3da1271051b629ac8b6b380 100644 |
--- a/lib/stats.js |
+++ b/lib/stats.js |
@@ -36,13 +36,18 @@ let getBlockedPerPage = |
*/ |
exports.getBlockedPerPage = page => blockedPerPage.get(page) || 0; |
-// Chrome automatically clears the browser action badge text when the URL of |
-// the tab is updated, but Firefox doesn't. |
-// https://bugzilla.mozilla.org/show_bug.cgi?id=1395074 |
-ext.pages.onLoading.addListener(page => |
+// Once nagivation for the tab has been committed to (e.g. it's no longer |
+// being prerendered) we clear its badge, or if some requests were already |
+// blocked beforehand we display those on the badge now. |
+browser.webNavigation.onCommitted.addListener(details => |
{ |
- if (!blockedPerPage.get(page)) |
- page.browserAction.setBadge(); |
+ let page = new ext.Page({id: details.tabId}); |
+ let blocked = blockedPerPage.get(page); |
+ |
+ page.browserAction.setBadge(blocked && { |
+ color: badgeColor, |
+ number: blocked |
+ }); |
}); |
FilterNotifier.on("filter.hitCount", (filter, newValue, oldValue, page) => |