summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-08 17:52:56 -0500
committerGitHub <noreply@github.com>2021-02-08 17:52:56 -0500
commit73e91b3b62f5ca07bcf2bf66e54e0d16af73dd42 (patch)
treef54ad3e54aac4fb23fb1ebb1755e89b9049dd833 /ext/fg/js/popup-proxy.js
parent3e5b30ff764a34d2f51dc67d64a05d3a98cbed86 (diff)
Refactor FrameOffsetForwarder (#1353)
* Add getChildFrameElement to FrameAncestryHandler * Add isRootFrame * Initialize _frameOffset to [0, 0] * Update FrameOffsetForwarder implementation * Update documentation
Diffstat (limited to 'ext/fg/js/popup-proxy.js')
-rw-r--r--ext/fg/js/popup-proxy.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 6d6c7fb9..bb037705 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -34,7 +34,7 @@ class PopupProxy extends EventDispatcher {
this._ownerFrameId = ownerFrameId;
this._frameOffsetForwarder = frameOffsetForwarder;
- this._frameOffset = null;
+ this._frameOffset = [0, 0];
this._frameOffsetPromise = null;
this._frameOffsetUpdatedAt = null;
this._frameOffsetExpireTimeout = 1000;
@@ -194,7 +194,12 @@ class PopupProxy extends EventDispatcher {
async _updateFrameOffsetInner(now) {
this._frameOffsetPromise = this._frameOffsetForwarder.getOffset();
try {
- const offset = await this._frameOffsetPromise;
+ let offset = null;
+ try {
+ offset = await this._frameOffsetPromise;
+ } catch (e) {
+ // NOP
+ }
this._frameOffset = offset !== null ? offset : [0, 0];
if (offset === null) {
this.trigger('offsetNotFound');