From 5330db11af07b6af9d19ff62e4371733088b049f Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 28 Aug 2017 14:37:49 +0300 Subject: [PATCH] FF: ignore lastError in sendMessage where irrelevant --- background/background.js | 2 +- js/messaging.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/background/background.js b/background/background.js index 0f7977a2..1b3dbc70 100644 --- a/background/background.js +++ b/background/background.js @@ -218,7 +218,7 @@ function webNavigationListener(method, {url, tabId, frameId}) { styles: url.startsWith(URLS.ownOrigin) ? 'DIY' : styles, }, { frameId - }); + }, ignoreChromeError); } // main page frame id is 0 if (frameId === 0) { diff --git a/js/messaging.js b/js/messaging.js index 31d8a5c2..594beeb0 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -75,6 +75,7 @@ function notifyAllTabs(msg) { style: getStyleWithNoCode(msg.style) }); } + const maybeIgnoreLastError = FIREFOX ? ignoreChromeError : undefined; const affectsAll = !msg.affects || msg.affects.all; const affectsOwnOriginOnly = !affectsAll && (msg.affects.editor || msg.affects.manager); const affectsTabs = affectsAll || affectsOwnOriginOnly; @@ -88,7 +89,7 @@ function notifyAllTabs(msg) { && !(affectsSelf && tab.url.startsWith(URLS.ownOrigin)) // skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF && (!FIREFOX || tab.width)) { - chrome.tabs.sendMessage(tab.id, msg); + chrome.tabs.sendMessage(tab.id, msg, maybeIgnoreLastError); } if (affectsIcon && BG) { BG.updateIcon(tab); @@ -115,7 +116,7 @@ function notifyAllTabs(msg) { } // notify background page and all open popups if (affectsSelf) { - chrome.runtime.sendMessage(msg); + chrome.runtime.sendMessage(msg, maybeIgnoreLastError); } }