From 3a23f081d1a11a233b855bdea1f6dcab9b593aca Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 8 Nov 2020 22:49:40 -0500 Subject: Frontend options override refactor (#1016) * Update how options context overriding works * Make function private --- ext/bg/js/settings/popup-preview-frame.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'ext/bg/js/settings') diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index 1a05a48d..d9b05368 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -28,7 +28,6 @@ class PopupPreviewFrame { this._frameId = frameId; this._popupFactory = popupFactory; this._frontend = null; - this._frontendGetOptionsContextOld = null; this._apiOptionsGetOld = null; this._popupSetCustomOuterCssOld = null; this._popupShown = false; @@ -78,8 +77,7 @@ class PopupPreviewFrame { pageType: 'web', allowRootFramePopupProxy: false }); - this._frontendGetOptionsContextOld = this._frontend.getOptionsContext.bind(this._frontend); - this._frontend.getOptionsContext = this._getOptionsContext.bind(this); + this._frontend.setOptionsContextOverride(this._optionsContext); await this._frontend.prepare(); this._frontend.setDisabledOverride(true); this._frontend.canClearSelection = false; @@ -96,14 +94,6 @@ class PopupPreviewFrame { // Private - async _getOptionsContext() { - let optionsContext = this._optionsContext; - if (optionsContext === null) { - optionsContext = this._frontendGetOptionsContextOld(); - } - return optionsContext; - } - async _apiOptionsGet(...args) { const options = await this._apiOptionsGetOld(...args); options.general.enable = true; @@ -213,6 +203,7 @@ class PopupPreviewFrame { async _updateOptionsContext({optionsContext}) { this._optionsContext = optionsContext; if (this._frontend === null) { return; } + this._frontend.setOptionsContextOverride(optionsContext); await this._frontend.updateOptions(); await this._updateSearch(); } -- cgit v1.2.3