From 9c7b9d666087add0f72900c045ee43ed05c5b467 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 26 Sep 2020 18:47:58 -0400 Subject: Fix page type never being detected as search page correctly (#867) --- ext/bg/js/search.js | 2 +- ext/bg/js/settings/popup-preview-frame.js | 2 +- ext/fg/js/content-script-main.js | 2 +- ext/fg/js/float.js | 3 ++- ext/fg/js/frontend.js | 6 +++--- ext/mixed/js/display.js | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js index f5b4a671..af88bb76 100644 --- a/ext/bg/js/search.js +++ b/ext/bg/js/search.js @@ -333,7 +333,7 @@ class DisplaySearch extends Display { await this.setupNestedPopups({ depth: 1, useProxyPopup: false, - isSearchPage: true + pageType: 'search' }); } catch (e) { yomichan.logError(e); diff --git a/ext/bg/js/settings/popup-preview-frame.js b/ext/bg/js/settings/popup-preview-frame.js index eb174917..bce5919d 100644 --- a/ext/bg/js/settings/popup-preview-frame.js +++ b/ext/bg/js/settings/popup-preview-frame.js @@ -62,7 +62,7 @@ class PopupPreviewFrame { parentPopupId: null, parentFrameId: null, useProxyPopup: false, - isSearchPage: false, + pageType: 'web', allowRootFramePopupProxy: false }); this._frontendGetOptionsContextOld = this._frontend.getOptionsContext.bind(this._frontend); diff --git a/ext/fg/js/content-script-main.js b/ext/fg/js/content-script-main.js index 84e78392..a427d10f 100644 --- a/ext/fg/js/content-script-main.js +++ b/ext/fg/js/content-script-main.js @@ -41,7 +41,7 @@ parentPopupId: null, parentFrameId: null, useProxyPopup: false, - isSearchPage: false, + pageType: 'web', allowRootFramePopupProxy: true }); await frontend.prepare(); diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js index 7f673bd5..bfa2195e 100644 --- a/ext/fg/js/float.js +++ b/ext/fg/js/float.js @@ -184,7 +184,8 @@ class DisplayFloat extends Display { depth, parentPopupId, parentFrameId, - useProxyPopup: true + useProxyPopup: true, + pageType: 'popup' }); } catch (e) { yomichan.logError(e); diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index e3988c94..13b0d80c 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -30,7 +30,7 @@ class Frontend { parentPopupId, parentFrameId, useProxyPopup, - isSearchPage, + pageType, allowRootFramePopupProxy }) { this._id = generateId(16); @@ -55,7 +55,7 @@ class Frontend { this._parentPopupId = parentPopupId; this._parentFrameId = parentFrameId; this._useProxyPopup = useProxyPopup; - this._isSearchPage = isSearchPage; + this._pageType = pageType; this._depth = depth; this._frameId = frameId; this._popupFactory = popupFactory; @@ -392,7 +392,7 @@ class Frontend { } if (this._updatePopupToken !== token) { return; } - if (this._isSearchPage) { + if (this._pageType === 'search') { this.setDisabledOverride(!this._options.scanning.enableOnSearchPage); } diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 377a491d..e5f12a1a 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -361,7 +361,7 @@ class Display extends EventDispatcher { } } - async setupNestedPopups({depth, parentPopupId, parentFrameId, useProxyPopup}) { + async setupNestedPopups({depth, parentPopupId, parentFrameId, useProxyPopup, pageType}) { await dynamicLoader.loadScripts([ '/mixed/js/text-scanner.js', '/mixed/js/frame-client.js', @@ -385,7 +385,7 @@ class Display extends EventDispatcher { parentPopupId, parentFrameId, useProxyPopup, - isSearchPage: false, + pageType, allowRootFramePopupProxy: true }); await frontend.prepare(); -- cgit v1.2.3