Move PopupProxyHost initialization
This commit is contained in:
parent
7ae0584077
commit
a2175f2c29
@ -47,7 +47,10 @@ class SettingsPopupPreview {
|
|||||||
window.apiOptionsGet = (...args) => this.apiOptionsGet(...args);
|
window.apiOptionsGet = (...args) => this.apiOptionsGet(...args);
|
||||||
|
|
||||||
// Overwrite frontend
|
// 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);
|
popup.setChildrenSupported(false);
|
||||||
|
|
||||||
this.frontend = new Frontend(popup);
|
this.frontend = new Frontend(popup);
|
||||||
|
@ -21,7 +21,13 @@ async function main() {
|
|||||||
const data = window.frontendInitializationData || {};
|
const data = window.frontendInitializationData || {};
|
||||||
const {id, depth=0, parentFrameId, ignoreNodes, url, proxy=false} = data;
|
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);
|
const frontend = new Frontend(popup, ignoreNodes);
|
||||||
await frontend.prepare();
|
await frontend.prepare();
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,6 @@ class PopupProxyHost {
|
|||||||
|
|
||||||
// Public functions
|
// Public functions
|
||||||
|
|
||||||
static create() {
|
|
||||||
const popupProxyHost = new PopupProxyHost();
|
|
||||||
popupProxyHost.prepare();
|
|
||||||
return popupProxyHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
async prepare() {
|
async prepare() {
|
||||||
this._frameIdPromise = apiFrameInformationGet();
|
this._frameIdPromise = apiFrameInformationGet();
|
||||||
const {frameId} = await this._frameIdPromise;
|
const {frameId} = await this._frameIdPromise;
|
||||||
@ -143,5 +137,3 @@ class PopupProxyHost {
|
|||||||
return popup.parent === null || popup.parent.isVisibleSync();
|
return popup.parent === null || popup.parent.isVisibleSync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PopupProxyHost.instance = PopupProxyHost.create();
|
|
||||||
|
Loading…
Reference in New Issue
Block a user