diff options
Diffstat (limited to 'ext/fg/js/popup-proxy-host.js')
-rw-r--r-- | ext/fg/js/popup-proxy-host.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 7d86aa67..49123ee1 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -47,7 +47,7 @@ class PopupProxyHost { ])); } - getOrCreatePopup(id=null, parentId=null) { + getOrCreatePopup(id=null, parentId=null, depth=null) { // Find by existing id if (id !== null) { const popup = this._popups.get(id); @@ -76,7 +76,14 @@ class PopupProxyHost { } // Create new popup - const depth = (parent !== null ? parent.depth + 1 : 0); + if (parent !== null) { + if (depth !== null) { + throw new Error('Depth cannot be set when parent exists'); + } + depth = parent.depth + 1; + } else if (depth === null) { + depth = 0; + } const popup = new Popup(id, depth, this._frameIdPromise); if (parent !== null) { popup.setParent(parent); |