WIP: make notifyAllTabs a noop

This commit is contained in:
eight 2018-10-08 15:30:39 +08:00
parent 582e9078af
commit a38558ef78
3 changed files with 8 additions and 3 deletions

View File

@ -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, {

View File

@ -429,5 +429,3 @@ const styleManager = (() => {
return url.split('#')[0];
}
})();
function notifyAllTabs() {}

View File

@ -519,3 +519,6 @@ function closeCurrentTab() {
}
});
}
// FIXME: remove this when #510 is merged
function notifyAllTabs() {}