summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index ee3bf646..df177289 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -39,7 +39,6 @@ class Popup extends EventDispatcher {
this._optionsContext = null;
this._contentScale = 1.0;
this._targetOrigin = chrome.runtime.getURL('/').replace(/\/$/, '');
- this._previousOptionsContextSource = null;
this._frameSizeContentScale = null;
this._frameClient = null;
@@ -105,14 +104,10 @@ class Popup extends EventDispatcher {
this._onVisibleChange({value: this.isVisibleSync()});
}
- async setOptionsContext(optionsContext, source) {
+ async setOptionsContext(optionsContext) {
this._optionsContext = optionsContext;
- this._previousOptionsContextSource = source;
-
this._options = await api.optionsGet(optionsContext);
this.updateTheme();
-
- this._invokeSafe('setOptionsContext', {optionsContext});
}
hide(changeFocus) {
@@ -154,9 +149,9 @@ class Popup extends EventDispatcher {
async showContent(details, displayDetails) {
if (this._options === null) { throw new Error('Options not assigned'); }
- const {source, optionsContext, elementRect, writingMode} = details;
- if (typeof source !== 'undefined' && source !== this._previousOptionsContextSource) {
- await this.setOptionsContext(optionsContext, source);
+ const {optionsContext, elementRect, writingMode} = details;
+ if (optionsContext !== null) {
+ await this._setOptionsContextIfDifferent(optionsContext);
}
if (typeof elementRect !== 'undefined' && typeof writingMode !== 'undefined') {
@@ -659,4 +654,9 @@ class Popup extends EventDispatcher {
bottom: window.innerHeight
};
}
+
+ async _setOptionsContextIfDifferent(optionsContext) {
+ if (deepEqual(this._optionsContext, optionsContext)) { return; }
+ await this.setOptionsContext(optionsContext);
+ }
}