summaryrefslogtreecommitdiff
path: root/ext/fg/js/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-22 14:33:41 -0400
committerGitHub <noreply@github.com>2020-08-22 14:33:41 -0400
commit1dc35dd6f13828a8d2a134de754ce54d33db4a86 (patch)
tree816f2ffcf724c1d50e7660370b57ca9d9a98b01e /ext/fg/js/frontend.js
parente9c540a0b9a13b2ff4a77d76928682b45f1968d5 (diff)
Popup factory proxy creation (#745)
* Change getOrCreatePopup to async * Rename parentFrameId to frameId, expose frameId property * Update how proxy popups are created
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r--ext/fg/js/frontend.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index e7fb7f47..9e3b902f 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -17,8 +17,6 @@
/* global
* DocumentUtil
- * FrameOffsetForwarder
- * PopupProxy
* TextScanner
* TextSourceElement
* api
@@ -58,7 +56,6 @@ class Frontend {
this._isSearchPage = isSearchPage;
this._depth = depth;
this._frameId = frameId;
- this._frameOffsetForwarder = new FrameOffsetForwarder(frameId);
this._popupFactory = popupFactory;
this._allowRootFramePopupProxy = allowRootFramePopupProxy;
this._popupCache = new Map();
@@ -83,8 +80,6 @@ class Frontend {
}
async prepare() {
- this._frameOffsetForwarder.prepare();
-
await this.updateOptions();
try {
const {zoomFactor} = await api.getZoom();
@@ -333,13 +328,20 @@ class Frontend {
return null;
}
- return this._popupFactory.getOrCreatePopup({depth: this._depth, ownerFrameId: this._frameId});
+ return await this._popupFactory.getOrCreatePopup({
+ frameId: this._frameId,
+ ownerFrameId: this._frameId,
+ depth: this._depth
+ });
}
async _getProxyPopup() {
- const popup = new PopupProxy(null, this._depth, this._parentPopupId, this._parentFrameId, this._frameId);
- await popup.prepare();
- return popup;
+ return await this._popupFactory.getOrCreatePopup({
+ frameId: this._parentFrameId,
+ ownerFrameId: this._frameId,
+ depth: this._depth,
+ parentPopupId: this._parentPopupId
+ });
}
async _getIframeProxyPopup() {
@@ -351,13 +353,15 @@ class Frontend {
return null;
}
- const popup = new PopupProxy(popupId, 0, null, targetFrameId, this._frameId, this._frameOffsetForwarder);
+ const popup = await this._popupFactory.getOrCreatePopup({
+ frameId: targetFrameId,
+ ownerFrameId: this._frameId,
+ id: popupId
+ });
popup.on('offsetNotFound', () => {
this._allowRootFramePopupProxy = false;
this._updatePopup();
});
- await popup.prepare();
-
return popup;
}