summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-02-13 15:04:10 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-02-13 15:04:10 +0200
commit38a6433a46a4259666864a57c5adbd58cb59db86 (patch)
treeb37f91246d6f50c653b33f495f35a2fa7696342e /ext
parent8abab28c4db4bae6e1bce003fc228d26e0458c78 (diff)
remove isInjected checks from Popup
Diffstat (limited to 'ext')
-rw-r--r--ext/fg/js/popup.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 6cfe49e5..ad4e5181 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -27,8 +27,6 @@ class Popup {
this._child = null;
this._childrenSupported = true;
this._injectPromise = null;
- this._isInjected = false;
- this._isInjectedAndLoaded = false;
this._visible = false;
this._visibleOverride = null;
this._options = null;
@@ -119,16 +117,12 @@ class Popup {
}
clearAutoPlayTimer() {
- if (this._isInjectedAndLoaded) {
- this._invokeApi('clearAutoPlayTimer');
- }
+ this._invokeApi('clearAutoPlayTimer');
}
setContentScale(scale) {
this._contentScale = scale;
- if (this._isInjectedAndLoaded) {
- this._invokeApi('setContentScale', {scale});
- }
+ this._invokeApi('setContentScale', {scale});
}
onMessage(e) {
@@ -160,7 +154,7 @@ class Popup {
}
isVisibleSync() {
- return this._isInjected && (this._visibleOverride !== null ? this._visibleOverride : this._visible);
+ return (this._visibleOverride !== null ? this._visibleOverride : this._visible);
}
updateTheme() {
@@ -239,7 +233,6 @@ class Popup {
return new Promise((resolve) => {
const parentFrameId = (typeof this._frameId === 'number' ? this._frameId : null);
this._container.addEventListener('load', () => {
- this._isInjectedAndLoaded = true;
this._invokeApi('initialize', {
options: this._options,
popupInfo: {
@@ -256,7 +249,6 @@ class Popup {
this._observeFullscreen();
this._onFullscreenChanged();
this.setCustomOuterCss(this._options.general.customPopupOuterCss, false);
- this._isInjected = true;
});
}
@@ -341,10 +333,9 @@ class Popup {
}
_invokeApi(action, params={}) {
- if (!this._isInjectedAndLoaded) {
- throw new Error('Frame not loaded');
+ if (this._container.contentWindow) {
+ this._container.contentWindow.postMessage({action, params}, '*');
}
- this._container.contentWindow.postMessage({action, params}, '*');
}
_observeFullscreen() {