diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-06-14 14:06:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 14:06:52 -0400 |
commit | b612bd8b8dc62a83e6800b052cc5f673a287dbe8 (patch) | |
tree | cc9778e15932de9a51ac8ee749b212ce44414f81 /ext/fg/js/content-script-main.js | |
parent | 8d1a276a83f954d587266cd94ef55063a5828b7e (diff) |
PopupProxy refactor (#609)
* Remove setDisabled member; replace with an event
* Pass frameOffsetForwarder directly to PopupProxy
* Replace .start with .prepare
* Make onMessage private
* Make message safer and handle unexpected inputs
Diffstat (limited to 'ext/fg/js/content-script-main.js')
-rw-r--r-- | ext/fg/js/content-script-main.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/fg/js/content-script-main.js b/ext/fg/js/content-script-main.js index cebda2d7..c31cde3f 100644 --- a/ext/fg/js/content-script-main.js +++ b/ext/fg/js/content-script-main.js @@ -49,9 +49,8 @@ async function createIframePopupProxy(frameOffsetForwarder, setDisabled) { api.broadcastTab('rootPopupRequestInformationBroadcast'); const {popupId, frameId: parentFrameId} = await rootPopupInformationPromise; - const getFrameOffset = frameOffsetForwarder.getOffset.bind(frameOffsetForwarder); - - const popup = new PopupProxy(popupId, 0, null, parentFrameId, getFrameOffset, setDisabled); + const popup = new PopupProxy(popupId, 0, null, parentFrameId, frameOffsetForwarder); + popup.on('offsetNotFound', setDisabled); await popup.prepare(); return popup; @@ -115,7 +114,7 @@ async function createPopupProxy(depth, id, parentFrameId) { if (!proxy && frameOffsetForwarder === null) { frameOffsetForwarder = new FrameOffsetForwarder(); - frameOffsetForwarder.start(); + frameOffsetForwarder.prepare(); } let popup; |