Bug 1907146 - Ensure SearchModeSwitcher detects searchmode changes. r=urlbar-reviewers,mak

Differential Revision: https://phabricator.services.mozilla.com/D216232
This commit is contained in:
Dale Harvey
2024-07-25 19:26:53 +00:00
parent aae0157290
commit 4f2b312c87
4 changed files with 45 additions and 15 deletions

View File

@@ -112,7 +112,6 @@ export class UrlbarInput {
eventTelemetryCategory: options.eventTelemetryCategory,
});
this.view = new lazy.UrlbarView(this);
this.searchModeSwitcher = new lazy.SearchModeSwitcher(this);
this.valueIsTyped = false;
this.formHistoryName = DEFAULT_FORM_HISTORY_NAME;
this.lastQueryContextPromise = Promise.resolve();
@@ -262,6 +261,7 @@ export class UrlbarInput {
this._initCopyCutController();
this._initPasteAndGo();
this._initStripOnShare();
this.searchModeSwitcher = new lazy.SearchModeSwitcher(this);
// Tracks IME composition.
this._compositionState = lazy.UrlbarUtils.COMPOSITION.NONE;
@@ -1885,7 +1885,6 @@ export class UrlbarInput {
// Enter search mode if the browser is selected.
if (browser == this.window.gBrowser.selectedBrowser) {
this._updateSearchModeUI(searchMode);
this.inputField.dispatchEvent(new CustomEvent("searchmodechanged"));
if (searchMode) {
// Set userTypedValue to the query string so that it's properly restored
// when switching back to the current tab and across sessions.
@@ -1978,6 +1977,7 @@ export class UrlbarInput {
set searchMode(searchMode) {
this.setSearchMode(searchMode, this.window.gBrowser.selectedBrowser);
this.searchModeSwitcher.onSearchModeChanged();
}
getBrowserState(browser) {