FF injects content script automatically

This commit is contained in:
tophf 2018-01-03 10:37:54 +03:00
parent 28e9e38dad
commit 3f570c4d3a

View File

@ -202,6 +202,9 @@ window.addEventListener('storageReady', function _() {
styles: {}, styles: {},
}); });
// Firefox injects content script automatically
if (FIREFOX) return;
const NTP = 'chrome://newtab/'; const NTP = 'chrome://newtab/';
const ALL_URLS = '<all_urls>'; const ALL_URLS = '<all_urls>';
const contentScripts = chrome.runtime.getManifest().content_scripts; const contentScripts = chrome.runtime.getManifest().content_scripts;
@ -238,7 +241,7 @@ window.addEventListener('storageReady', function _() {
queryTabs().then(tabs => queryTabs().then(tabs =>
tabs.forEach(tab => { tabs.forEach(tab => {
// 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
if (!FIREFOX || tab.width) { if (tab.width) {
contentScripts.forEach(cs => contentScripts.forEach(cs =>
setTimeout(pingCS, 0, cs, tab)); setTimeout(pingCS, 0, cs, tab));
} }