always set browserAction title

This commit is contained in:
gorhill 2017-07-25 09:16:48 -04:00
parent e86290e988
commit 645c862886
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 9 additions and 6 deletions

View File

@ -614,7 +614,8 @@ vAPI.tabs.injectScript = function(tabId, details, callback) {
// Firefox for Android does no support browser.browserAction.setIcon().
vAPI.setIcon = (function() {
var titleTemplate = chrome.runtime.getManifest().name + ' ({badge})';
var browserAction = chrome.browserAction,
titleTemplate = chrome.runtime.getManifest().name + ' ({badge})';
var iconPaths = [
{
'19': 'img/browsericons/icon19-off.png',
@ -630,8 +631,8 @@ vAPI.setIcon = (function() {
tabId = toChromiumTabId(tabId);
if ( tabId === 0 ) { return; }
if ( chrome.browserAction.setIcon !== undefined ) {
chrome.browserAction.setIcon(
if ( browserAction.setIcon !== undefined ) {
browserAction.setIcon(
{
tabId: tabId,
path: iconPaths[iconStatus === 'on' ? 1 : 0]
@ -650,8 +651,10 @@ vAPI.setIcon = (function() {
}
}
);
} else if ( chrome.browserAction.setTitle !== undefined ) {
chrome.browserAction.setTitle({
}
if ( browserAction.setTitle !== undefined ) {
browserAction.setTitle({
tabId: tabId,
title: titleTemplate.replace(
'{badge}',

View File

@ -903,7 +903,7 @@ vAPI.tabs.registerListeners();
if ( vAPI.isBehindTheSceneTabId(tabId) ) {
return;
}
tabIdToTimer[tabId] = vAPI.setTimeout(updateBadge.bind(this, tabId), 666);
tabIdToTimer[tabId] = vAPI.setTimeout(updateBadge.bind(this, tabId), 701);
};
})();