silence some useless warnings in console

This commit is contained in:
tophf 2017-11-25 21:47:02 +03:00
parent fc0b1dc739
commit cbe90272b9
2 changed files with 12 additions and 8 deletions

View File

@ -317,11 +317,13 @@ function updateIcon(tab, styles) {
}
// Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor
chrome.browserAction.setBadgeBackgroundColor({color});
getTab(tab.id).then(realTab => {
// skip pre-rendered tabs
if (realTab.index >= 0) {
chrome.browserAction.setBadgeText({text, tabId: tab.id});
}
setTimeout(() => {
getTab(tab.id).then(realTab => {
// skip pre-rendered tabs
if (realTab.index >= 0) {
chrome.browserAction.setBadgeText({text, tabId: tab.id});
}
});
});
});
}
@ -376,7 +378,7 @@ function onRuntimeMessage(request, sender, sendResponseInternal) {
case 'closeTab':
chrome.tabs.remove(request.tabId || sender.tab.id, () => {
if (chrome.runtime.lastError) {
if (chrome.runtime.lastError && request.tabId !== sender.tab.id) {
sendResponse(new Error(chrome.runtime.lastError.message));
}
});

View File

@ -299,7 +299,7 @@ var prefs = new function Prefs() {
// Polyfill for Firefox < 53 https://bugzilla.mozilla.org/show_bug.cgi?id=1220494
function getSync() {
if ('sync' in chrome.storage) {
if ('sync' in chrome.storage && !chrome.runtime.id.includes('@temporary')) {
return chrome.storage.sync;
}
const crappyStorage = {};
@ -313,7 +313,9 @@ var prefs = new function Prefs() {
crappyStorage[property] = source[property];
}
}
callback();
if (typeof callback === 'function') {
callback();
}
}
};
}