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 => { cs.matches.some(match => {
if ((match === ALL_URLS || url.match(match)) && if ((match === ALL_URLS || url.match(match)) &&
(!url.startsWith('chrome') || url === NTP)) { (!url.startsWith('chrome') || url === NTP)) {
// TODO: add a `msg.pingTab` API?
msg.sendTab(id, {method: 'ping'}) msg.sendTab(id, {method: 'ping'})
.catch(() => false)
.then(pong => !pong && injectCS(cs, id)); .then(pong => !pong && injectCS(cs, id));
return true; return true;
} }
@ -304,7 +306,8 @@ window.addEventListener('storageReady', function _() {
function webNavUsercssInstallerFF(data) { function webNavUsercssInstallerFF(data) {
const {tabId} = data; const {tabId} = data;
Promise.all([ 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 // 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 // and also to skip the double-invocation in FF which assigns tab url later
getTab(tabId), getTab(tabId),
@ -319,6 +322,7 @@ function webNavUsercssInstallerFF(data) {
function webNavIframeHelperFF({tabId, frameId}) { function webNavIframeHelperFF({tabId, frameId}) {
if (!frameId) return; if (!frameId) return;
msg.sendTab(tabId, {method: 'ping'}, {frameId}) msg.sendTab(tabId, {method: 'ping'}, {frameId})
.catch(() => false)
.then(pong => { .then(pong => {
if (pong) return; if (pong) return;
chrome.tabs.executeScript(tabId, { chrome.tabs.executeScript(tabId, {

View File

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

View File

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