Fix page type never being detected as search page correctly (#867)

This commit is contained in:
toasted-nutbread 2020-09-26 18:47:58 -04:00 committed by GitHub
parent c1b5976394
commit 9c7b9d6660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 9 deletions

View File

@ -333,7 +333,7 @@ class DisplaySearch extends Display {
await this.setupNestedPopups({ await this.setupNestedPopups({
depth: 1, depth: 1,
useProxyPopup: false, useProxyPopup: false,
isSearchPage: true pageType: 'search'
}); });
} catch (e) { } catch (e) {
yomichan.logError(e); yomichan.logError(e);

View File

@ -62,7 +62,7 @@ class PopupPreviewFrame {
parentPopupId: null, parentPopupId: null,
parentFrameId: null, parentFrameId: null,
useProxyPopup: false, useProxyPopup: false,
isSearchPage: false, pageType: 'web',
allowRootFramePopupProxy: false allowRootFramePopupProxy: false
}); });
this._frontendGetOptionsContextOld = this._frontend.getOptionsContext.bind(this._frontend); this._frontendGetOptionsContextOld = this._frontend.getOptionsContext.bind(this._frontend);

View File

@ -41,7 +41,7 @@
parentPopupId: null, parentPopupId: null,
parentFrameId: null, parentFrameId: null,
useProxyPopup: false, useProxyPopup: false,
isSearchPage: false, pageType: 'web',
allowRootFramePopupProxy: true allowRootFramePopupProxy: true
}); });
await frontend.prepare(); await frontend.prepare();

View File

@ -184,7 +184,8 @@ class DisplayFloat extends Display {
depth, depth,
parentPopupId, parentPopupId,
parentFrameId, parentFrameId,
useProxyPopup: true useProxyPopup: true,
pageType: 'popup'
}); });
} catch (e) { } catch (e) {
yomichan.logError(e); yomichan.logError(e);

View File

@ -30,7 +30,7 @@ class Frontend {
parentPopupId, parentPopupId,
parentFrameId, parentFrameId,
useProxyPopup, useProxyPopup,
isSearchPage, pageType,
allowRootFramePopupProxy allowRootFramePopupProxy
}) { }) {
this._id = generateId(16); this._id = generateId(16);
@ -55,7 +55,7 @@ class Frontend {
this._parentPopupId = parentPopupId; this._parentPopupId = parentPopupId;
this._parentFrameId = parentFrameId; this._parentFrameId = parentFrameId;
this._useProxyPopup = useProxyPopup; this._useProxyPopup = useProxyPopup;
this._isSearchPage = isSearchPage; this._pageType = pageType;
this._depth = depth; this._depth = depth;
this._frameId = frameId; this._frameId = frameId;
this._popupFactory = popupFactory; this._popupFactory = popupFactory;
@ -392,7 +392,7 @@ class Frontend {
} }
if (this._updatePopupToken !== token) { return; } if (this._updatePopupToken !== token) { return; }
if (this._isSearchPage) { if (this._pageType === 'search') {
this.setDisabledOverride(!this._options.scanning.enableOnSearchPage); this.setDisabledOverride(!this._options.scanning.enableOnSearchPage);
} }

View File

@ -361,7 +361,7 @@ class Display extends EventDispatcher {
} }
} }
async setupNestedPopups({depth, parentPopupId, parentFrameId, useProxyPopup}) { async setupNestedPopups({depth, parentPopupId, parentFrameId, useProxyPopup, pageType}) {
await dynamicLoader.loadScripts([ await dynamicLoader.loadScripts([
'/mixed/js/text-scanner.js', '/mixed/js/text-scanner.js',
'/mixed/js/frame-client.js', '/mixed/js/frame-client.js',
@ -385,7 +385,7 @@ class Display extends EventDispatcher {
parentPopupId, parentPopupId,
parentFrameId, parentFrameId,
useProxyPopup, useProxyPopup,
isSearchPage: false, pageType,
allowRootFramePopupProxy: true allowRootFramePopupProxy: true
}); });
await frontend.prepare(); await frontend.prepare();