Handle 'No tab with such id'

This commit is contained in:
Ilya Ig. Petrov 2017-03-05 12:44:33 +00:00
parent 091141f2cf
commit 182a443cc4
2 changed files with 11 additions and 3 deletions

View File

@ -16,6 +16,8 @@
{ {
const chromified = window.utils.chromified;
window.chrome.browserAction.setBadgeBackgroundColor({ window.chrome.browserAction.setBadgeBackgroundColor({
color: '#db4b2f', color: '#db4b2f',
}); });
@ -47,8 +49,14 @@
chrome.browserAction.getTitle( chrome.browserAction.getTitle(
{tabId: requestDetails.tabId}, {tabId: requestDetails.tabId},
(title) => { chromified((err, title) => {
if (err) {
// E.g., no tab with such id happens.
// Because requestDetails may be stale.
console.log('Notifier error ignored:', err);
return cb();
}
const ifTitleSetAlready = /\n/.test(title); const ifTitleSetAlready = /\n/.test(title);
const hostname = new URL( requestDetails.url ).hostname; const hostname = new URL( requestDetails.url ).hostname;
@ -118,7 +126,7 @@
return cb(); return cb();
} })
); );
}; };

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
const commonContext = { const commonContext = {
version: '0.25', version: '0.26',
}; };
exports.contexts = {}; exports.contexts = {};