diff --git a/popup/popup.js b/popup/popup.js index bf32158..1ca9242 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -382,10 +382,21 @@ var browser = (browserType === 'firefox') ? browser : (browserType === 'chrome') ui = new UI(); ui.switchPanel( 'loaded' ); } - chrome.runtime.onMessage.addListener((message, sender) => { - console.log(sender); - if (message.state === "ready") { + if (browserType === "chrome") { + chrome.runtime.onMessage.addListener((message, sender) => { + if (message.state === "ready") { + ui = new UI(); + } + }); + } else { + let state = _backgroundPage.state; + function waitWhileLoading() { + if (state === "ready") { ui = new UI(); + } else { + setTimeout(waitWhileLoading, 100); } - }); + } + waitWhileLoading(); + } })();