diff options
Diffstat (limited to 'ext/fg/js/popup-proxy-host.js')
| -rw-r--r-- | ext/fg/js/popup-proxy-host.js | 32 | 
1 files changed, 18 insertions, 14 deletions
| diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 697c8077..157097de 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -52,25 +52,13 @@ class PopupProxyHost {      }      createPopup(parentId, depth) { -        const parent = (typeof parentId === 'string' && this._popups.has(parentId) ? this._popups.get(parentId) : null); -        const id = `${this._nextId}`; -        if (parent !== null) { -            depth = parent.depth + 1; -        } -        ++this._nextId; -        const popup = new Popup(id, depth, this._frameIdPromise); -        if (parent !== null) { -            popup.parent = parent; -            parent.child = popup; -        } -        this._popups.set(id, popup); -        return popup; +        return this._createPopupInternal(parentId, depth).popup;      }      // Message handlers      async _onApiCreateNestedPopup(parentId) { -        return this.createPopup(parentId, 0).id; +        return this._createPopupInternal(parentId, 0).id;      }      async _onApiSetOptions(id, options) { @@ -117,6 +105,22 @@ class PopupProxyHost {      // Private functions +    _createPopupInternal(parentId, depth) { +        const parent = (typeof parentId === 'string' && this._popups.has(parentId) ? this._popups.get(parentId) : null); +        const id = `${this._nextId}`; +        if (parent !== null) { +            depth = parent.depth + 1; +        } +        ++this._nextId; +        const popup = new Popup(id, depth, this._frameIdPromise); +        if (parent !== null) { +            popup.parent = parent; +            parent.child = popup; +        } +        this._popups.set(id, popup); +        return {popup, id}; +    } +      _getPopup(id) {          const popup = this._popups.get(id);          if (typeof popup === 'undefined') { |