aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-08 19:04:53 -0400
committerGitHub <noreply@github.com>2020-05-08 19:04:53 -0400
commitb936c3e4b1bc993e535b02dee91bf6afc15a3564 (patch)
tree389b05a78e4b1d8f4d6184516d8418b0816f3d63 /ext/bg/js
parentb972f8cbf671c0e09603d54153a6344b105f41d9 (diff)
Popup proxy host refactor (#516)
* Rename PopupProxyHost to PopupFactory * Update FrontendApiReceiver to support non-async handlers * Make some functions non-async * Make setCustomCss non-async * Make setContentScale non-async * Remove static * Rename variables * Pass frameId into PopupFactory's constructor * Change FrontendApiReceiver source from popup-proxy-host to popup-factor * Rename _invokeHostApi to _invoke * Rename PopupProxy.getHostUrl to getUrl
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/search-main.js2
-rw-r--r--ext/bg/js/settings/popup-preview-frame.js11
2 files changed, 8 insertions, 5 deletions
diff --git a/ext/bg/js/search-main.js b/ext/bg/js/search-main.js
index 1075d46e..6e092fbc 100644
--- a/ext/bg/js/search-main.js
+++ b/ext/bg/js/search-main.js
@@ -31,7 +31,7 @@ async function injectSearchFrontend() {
'/fg/js/frontend-api-receiver.js',
'/fg/js/frame-offset-forwarder.js',
'/fg/js/popup.js',
- '/fg/js/popup-proxy-host.js',
+ '/fg/js/popup-factory.js',
'/fg/js/frontend.js',
'/fg/js/content-script-main.js'
]);
diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js
index c7b0c218..8901a0c4 100644
--- a/ext/bg/js/settings/popup-preview-frame.js
+++ b/ext/bg/js/settings/popup-preview-frame.js
@@ -18,8 +18,9 @@
/* global
* Frontend
* Popup
- * PopupProxyHost
+ * PopupFactory
* TextSourceRange
+ * apiFrameInformationGet
* apiOptionsGet
*/
@@ -56,10 +57,12 @@ class SettingsPopupPreview {
window.apiOptionsGet = this.apiOptionsGet.bind(this);
// Overwrite frontend
- const popupHost = new PopupProxyHost();
- await popupHost.prepare();
+ const {frameId} = await apiFrameInformationGet();
- this.popup = popupHost.getOrCreatePopup();
+ const popupFactory = new PopupFactory(frameId);
+ await popupFactory.prepare();
+
+ this.popup = popupFactory.getOrCreatePopup();
this.popup.setChildrenSupported(false);
this.popupSetCustomOuterCssOld = this.popup.setCustomOuterCss;