summaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-22 14:39:07 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-05 19:57:37 +0300
commit7928c5d71324b3eebece7e2a26e9783e139066d5 (patch)
treed7b288011e9359ddd7873516dd501808600ccff3 /ext/fg
parent9f9ea1d5fb9f383992523a2a9a8a02259ced838e (diff)
error handling
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/popup-proxy.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 0cd5bbad..fd07ee46 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -129,19 +129,29 @@ class PopupProxy {
if (this._frameOffsetPromise === null && !expired) { return; }
if (this._frameOffsetPromise !== null) {
- await this._frameOffsetPromise;
+ if (firstRun) {
+ await this._frameOffsetPromise;
+ }
return;
}
+ this._frameOffsetPromise = this._getFrameOffset();
if (firstRun) {
- this._frameOffsetPromise = this._getFrameOffset();
- this._frameOffset = await this._frameOffsetPromise;
+ try {
+ this._frameOffset = await this._frameOffsetPromise;
+ this._frameOffsetUpdatedAt = Date.now();
+ } catch (e) {
+ console.error(e);
+ }
this._frameOffsetPromise = null;
- this._frameOffsetUpdatedAt = Date.now();
} else {
- this._getFrameOffset().then((offset) => {
+ this._frameOffsetPromise.then((offset) => {
this._frameOffset = offset;
this._frameOffsetUpdatedAt = Date.now();
+ this._frameOffsetPromise = null;
+ }, (e) => {
+ console.error(e);
+ this._frameOffsetPromise = null;
});
}
}