From a38558ef786fccb7cbf46327be3036b608e286b1 Mon Sep 17 00:00:00 2001 From: eight Date: Mon, 8 Oct 2018 15:30:39 +0800 Subject: [PATCH] WIP: make notifyAllTabs a noop --- background/background.js | 6 +++++- background/style-manager.js | 2 -- js/messaging.js | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/background/background.js b/background/background.js index 85f1385c..7bf69067 100644 --- a/background/background.js +++ b/background/background.js @@ -282,7 +282,9 @@ window.addEventListener('storageReady', function _() { cs.matches.some(match => { if ((match === ALL_URLS || url.match(match)) && (!url.startsWith('chrome') || url === NTP)) { + // TODO: add a `msg.pingTab` API? msg.sendTab(id, {method: 'ping'}) + .catch(() => false) .then(pong => !pong && injectCS(cs, id)); return true; } @@ -304,7 +306,8 @@ window.addEventListener('storageReady', function _() { function webNavUsercssInstallerFF(data) { const {tabId} = data; Promise.all([ - msg.sendTab(tabId, {method: 'ping'}), + msg.sendTab(tabId, {method: 'ping'}) + .catch(() => false), // we need tab index to open the installer next to the original one // and also to skip the double-invocation in FF which assigns tab url later getTab(tabId), @@ -319,6 +322,7 @@ function webNavUsercssInstallerFF(data) { function webNavIframeHelperFF({tabId, frameId}) { if (!frameId) return; msg.sendTab(tabId, {method: 'ping'}, {frameId}) + .catch(() => false) .then(pong => { if (pong) return; chrome.tabs.executeScript(tabId, { diff --git a/background/style-manager.js b/background/style-manager.js index 26e151ee..c70e4b75 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -429,5 +429,3 @@ const styleManager = (() => { return url.split('#')[0]; } })(); - -function notifyAllTabs() {} diff --git a/js/messaging.js b/js/messaging.js index 4b989b90..eb83a738 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -519,3 +519,6 @@ function closeCurrentTab() { } }); } + +// FIXME: remove this when #510 is merged +function notifyAllTabs() {}