silence some useless warnings in console

This commit is contained in:
tophf 2017-11-25 21:47:02 +03:00
parent 8efce3220a
commit e5e21c0a15
2 changed files with 9 additions and 7 deletions

View File

@ -372,11 +372,13 @@ function updateIcon(tab, styles) {
} }
// Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor // Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor
chrome.browserAction.setBadgeBackgroundColor({color}); chrome.browserAction.setBadgeBackgroundColor({color});
getTab(tab.id).then(realTab => { setTimeout(() => {
// skip pre-rendered tabs getTab(tab.id).then(realTab => {
if (realTab.index >= 0) { // skip pre-rendered tabs
chrome.browserAction.setBadgeText({text, tabId: tab.id}); if (realTab.index >= 0) {
} chrome.browserAction.setBadgeText({text, tabId: tab.id});
}
});
}); });
}); });
} }
@ -427,7 +429,7 @@ function onRuntimeMessage(request, sender, sendResponseInternal) {
case 'closeTab': case 'closeTab':
chrome.tabs.remove(request.tabId || sender.tab.id, () => { 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)); 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 // Polyfill for Firefox < 53 https://bugzilla.mozilla.org/show_bug.cgi?id=1220494
function getSync() { function getSync() {
if ('sync' in chrome.storage) { if ('sync' in chrome.storage && !chrome.runtime.id.includes('@temporary')) {
return chrome.storage.sync; return chrome.storage.sync;
} }
const crappyStorage = {}; const crappyStorage = {};