From e5e21c0a15b0e27ed641e4220e9bd043a4f7023f Mon Sep 17 00:00:00 2001 From: tophf Date: Sat, 25 Nov 2017 21:47:02 +0300 Subject: [PATCH] silence some useless warnings in console --- background/background.js | 14 ++++++++------ js/prefs.js | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/background/background.js b/background/background.js index af8127ee..b3f4842e 100644 --- a/background/background.js +++ b/background/background.js @@ -372,11 +372,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}); + } + }); }); }); } @@ -427,7 +429,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)); } }); diff --git a/js/prefs.js b/js/prefs.js index a0238e92..b1e1dec7 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -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 = {};