diff options
-rw-r--r-- | ext/fg/js/popup-proxy-host.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index de182afe..f2e2f5d0 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -19,7 +19,7 @@ class PopupProxyHost { constructor() { - this.popups = {}; + this.popups = new Map(); this.nextId = 0; this.apiReceiver = null; this.frameIdPromise = null; @@ -50,7 +50,7 @@ class PopupProxyHost { } createPopup(parentId, depth) { - const parent = (typeof parentId === 'string' && hasOwn(this.popups, parentId) ? this.popups[parentId] : null); + 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; @@ -61,7 +61,7 @@ class PopupProxyHost { popup.parent = parent; parent.child = popup; } - this.popups[id] = popup; + this.popups.set(id, popup); return popup; } @@ -70,11 +70,11 @@ class PopupProxyHost { } getPopup(id) { - if (!hasOwn(this.popups, id)) { + const popup = this.popups.get(id); + if (typeof popup === 'undefined') { throw new Error('Invalid popup ID'); } - - return this.popups[id]; + return popup; } jsonRectToDOMRect(popup, jsonRect) { |