Ensure both Popup and PopupProxy have valid depth

This commit is contained in:
toasted-nutbread 2019-09-07 13:11:25 -04:00
parent aae971a09e
commit 99ca60d4c1
2 changed files with 4 additions and 4 deletions

View File

@ -40,9 +40,9 @@ class Frontend {
static create() {
const initializationData = window.frontendInitializationData;
const isNested = (initializationData !== null && typeof initializationData === 'object');
const {id, parentFrameId, ignoreNodes} = isNested ? initializationData : {};
const {id, depth, parentFrameId, ignoreNodes} = isNested ? initializationData : {};
const popup = isNested ? new PopupProxy(id, parentFrameId) : PopupProxyHost.instance.createPopup(null);
const popup = isNested ? new PopupProxy(depth + 1, id, parentFrameId) : PopupProxyHost.instance.createPopup(null);
const frontend = new Frontend(popup, ignoreNodes);
frontend.prepare();
return frontend;

View File

@ -18,14 +18,14 @@
class PopupProxy {
constructor(parentId, parentFrameId) {
constructor(depth, parentId, parentFrameId) {
this.parentId = parentId;
this.parentFrameId = parentFrameId;
this.id = null;
this.idPromise = null;
this.parent = null;
this.child = null;
this.depth = 0;
this.depth = depth;
this.container = null;