FF: ignore lastError in sendMessage where irrelevant

This commit is contained in:
tophf 2017-08-28 14:37:49 +03:00
parent cd6bcc6511
commit 5330db11af
2 changed files with 4 additions and 3 deletions

View File

@ -218,7 +218,7 @@ function webNavigationListener(method, {url, tabId, frameId}) {
styles: url.startsWith(URLS.ownOrigin) ? 'DIY' : styles, styles: url.startsWith(URLS.ownOrigin) ? 'DIY' : styles,
}, { }, {
frameId frameId
}); }, ignoreChromeError);
} }
// main page frame id is 0 // main page frame id is 0
if (frameId === 0) { if (frameId === 0) {

View File

@ -75,6 +75,7 @@ function notifyAllTabs(msg) {
style: getStyleWithNoCode(msg.style) style: getStyleWithNoCode(msg.style)
}); });
} }
const maybeIgnoreLastError = FIREFOX ? ignoreChromeError : undefined;
const affectsAll = !msg.affects || msg.affects.all; const affectsAll = !msg.affects || msg.affects.all;
const affectsOwnOriginOnly = !affectsAll && (msg.affects.editor || msg.affects.manager); const affectsOwnOriginOnly = !affectsAll && (msg.affects.editor || msg.affects.manager);
const affectsTabs = affectsAll || affectsOwnOriginOnly; const affectsTabs = affectsAll || affectsOwnOriginOnly;
@ -88,7 +89,7 @@ function notifyAllTabs(msg) {
&& !(affectsSelf && tab.url.startsWith(URLS.ownOrigin)) && !(affectsSelf && tab.url.startsWith(URLS.ownOrigin))
// skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF // skip lazy-loaded aka unloaded tabs that seem to start loading on message in FF
&& (!FIREFOX || tab.width)) { && (!FIREFOX || tab.width)) {
chrome.tabs.sendMessage(tab.id, msg); chrome.tabs.sendMessage(tab.id, msg, maybeIgnoreLastError);
} }
if (affectsIcon && BG) { if (affectsIcon && BG) {
BG.updateIcon(tab); BG.updateIcon(tab);
@ -115,7 +116,7 @@ function notifyAllTabs(msg) {
} }
// notify background page and all open popups // notify background page and all open popups
if (affectsSelf) { if (affectsSelf) {
chrome.runtime.sendMessage(msg); chrome.runtime.sendMessage(msg, maybeIgnoreLastError);
} }
} }