From 5ecc20f249ba6b66e00559026c2d619fc6f839a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20=C5=A0tamcar?= Date: Fri, 13 Sep 2024 17:58:06 +0200 Subject: [PATCH] Prevent error when changing the search mode --- native/userchrome/profile/chrome/pwa/content/browser.jsm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/native/userchrome/profile/chrome/pwa/content/browser.jsm b/native/userchrome/profile/chrome/pwa/content/browser.jsm index fdb3ea41..35e5259a 100644 --- a/native/userchrome/profile/chrome/pwa/content/browser.jsm +++ b/native/userchrome/profile/chrome/pwa/content/browser.jsm @@ -324,7 +324,16 @@ class PwaBrowser { // Also un-focus the URL bar in case it is focused for some reason document.getElementById('urlbar').removeAttribute('focused'); + // Restore the original toolbar visibility window.toolbar.visible = originalToolbarVisibility; + + // Prevent error when changing search mode when `searchModeSwitcher` is undefined + Object.defineProperty(window.gURLBar, 'searchMode', { + set: function (searchMode) { + this.setSearchMode(searchMode, this.window.gBrowser.selectedBrowser); + this.searchModeSwitcher?.onSearchModeChanged(); + }, + }); } setDisplayModeStandalone () {