diff --git a/js/messaging.js b/js/messaging.js index 9a08e0f1..05ba5c73 100644 --- a/js/messaging.js +++ b/js/messaging.js @@ -46,7 +46,12 @@ URLS.supported = new RegExp( ); let BG = chrome.extension.getBackgroundPage(); - +if (BG && !BG.getStyles) { + // own page like editor/manage is being loaded on browser startup + // before the background page has been fully initialized; + // it'll be resolved in onBackgroundReady() instead + BG = null; +} if (!BG || BG !== window) { document.documentElement.classList.toggle('firefox', FIREFOX); document.documentElement.classList.toggle('opera', OPERA); @@ -57,6 +62,7 @@ if (!BG || BG !== window) { } } + function notifyAllTabs(msg) { const originalMessage = msg; if (msg.method === 'styleUpdated' || msg.method === 'styleAdded') {