From 99ca60d4c1456f243d8142b4502db441e33340a4 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 7 Sep 2019 13:11:25 -0400 Subject: [PATCH] Ensure both Popup and PopupProxy have valid depth --- ext/fg/js/frontend.js | 4 ++-- ext/fg/js/popup-proxy.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 83e0cef1..5e12d101 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -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; diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index f6295079..56e710eb 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -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;