| Index: lib/stats.js |
| diff --git a/lib/stats.js b/lib/stats.js |
| index f64c2cee9f5835610f8e08da253473a32ea9c895..24aef8a407dcba7a56e483735a7cedf1bb93269f 100644 |
| --- a/lib/stats.js |
| +++ b/lib/stats.js |
| @@ -93,3 +93,21 @@ Prefs.on("show_statsinicon", () => |
| port.on("stats.getBlockedPerPage", |
| message => getBlockedPerPage(new ext.Page(message.tab))); |
| + |
| +// We sometimes set the badge text before Chrome considers the tab to have been |
| +// updated. In those cases Chrome automatically clears the text again, so the |
| +// blocked count will only flash for a second. To work around that we wait for |
| +// the navigation to be committed and then update the text again. |
| +browser.webNavigation.onCommitted.addListener(details => |
| +{ |
| + let page = new ext.Page({id: details.tabId}); |
| + let blocked = blockedPerPage.get(page); |
| + |
| + if (blocked) |
| + { |
| + page.browserAction.setBadge({ |
| + color: badgeColor, |
| + number: blocked |
| + }); |
| + } |
| +}); |