diff options
-rw-r--r-- | ext/bg/js/settings/popup-preview-frame.js | 5 | ||||
-rw-r--r-- | ext/fg/js/frontend-initialize.js | 8 | ||||
-rw-r--r-- | ext/fg/js/popup-proxy-host.js | 8 |
3 files changed, 11 insertions, 10 deletions
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 53077a83..6d017275 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -47,7 +47,10 @@ class SettingsPopupPreview { window.apiOptionsGet = (...args) => this.apiOptionsGet(...args); // Overwrite frontend - const popup = PopupProxyHost.instance.createPopup(null, 0); + const popupHost = new PopupProxyHost(); + await popupHost.prepare(); + + const popup = popupHost.createPopup(null, 0); popup.setChildrenSupported(false); this.frontend = new Frontend(popup); diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js index 4fef3a2e..c153b5b6 100644 --- a/ext/fg/js/frontend-initialize.js +++ b/ext/fg/js/frontend-initialize.js @@ -21,7 +21,13 @@ async function main() { const data = window.frontendInitializationData || {}; const {id, depth=0, parentFrameId, ignoreNodes, url, proxy=false} = data; - const popup = proxy ? new PopupProxy(depth + 1, id, parentFrameId, url) : PopupProxyHost.instance.createPopup(null, depth); + let popupHost = null; + if (!proxy) { + popupHost = new PopupProxyHost(); + await popupHost.prepare(); + } + + const popup = proxy ? new PopupProxy(depth + 1, id, parentFrameId, url) : popupHost.createPopup(null, depth); const frontend = new Frontend(popup, ignoreNodes); await frontend.prepare(); } diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 9ff8a8c8..e13d6f05 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -27,12 +27,6 @@ class PopupProxyHost { // Public functions - static create() { - const popupProxyHost = new PopupProxyHost(); - popupProxyHost.prepare(); - return popupProxyHost; - } - async prepare() { this._frameIdPromise = apiFrameInformationGet(); const {frameId} = await this._frameIdPromise; @@ -143,5 +137,3 @@ class PopupProxyHost { return popup.parent === null || popup.parent.isVisibleSync(); } } - -PopupProxyHost.instance = PopupProxyHost.create(); |