Open Bug 1790429 Opened 2 years ago Updated 2 months ago

Search terms or URI in the urlbar don't update when a user changes their default search engine until they reload the page

Categories

(Firefox :: Address Bar, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: jteow, Unassigned)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [sng-scotchbonnet-followon][scotchbonnet-persistsearchterms])

Attachments

(1 obsolete file)

The showSearchTerms feature doesn't update the state of the urlbar if the user changes their default engine.

So if a user has this feature enabled, and switches their default search engine, existing tabs showing a default SERP will still show the search terms instead of the full URI.

Likewise, SERPs that were initially done via a non-default engine but become default will show the URIs.

The simplest way of solving this is to listen to when the engine changes. When it does, and if the user has the preference enabled, go through each tab and check the URI against _getSearchTermIfDefaultSerpUrl. This however might be a major performance issue for browsers with a lot of tabs open.

We should look to keep userTypedValue untouched if the user was the one who actually typed it and only flip the current url in the urlbar to search terms if the page is a newly default SERP AND userTypedValue isn't populated by a value that the user provided. And likewise, a browser that was on a default SERP but is now no longer default should no longer be showing the search term in the urlbar.

There's two things to consider: selected browsers and non-selected browsers. When returning to an non-selected browser, UrlbarInput will call setURI due to onLocationChange. Just by modifying a browsers userTypedValue we can ensure returning to the tab will result in the change we desire.

However, for browsers that are in focus, we would need to manually call setURI on the window's Urlbar when the default engine changes and certain conditions are met.

Assuming the pref is on, here are some states to consider:

  1. A browser that was on a default SERP and is showing the search term but is now a non-default SERP: It should show the full url.
  2. A browser that was on a default SERP and userTypedValue is what the user wrote, but the page is now a non-default SERP: userTypedValue should remain the same.
  3. A browser that was on a non-default SERP and is showing a URL but is now a non-default SERP: It should show the search terms.
  4. A browser that was on a non-default SERP and is showing a user typed term but is now a default-SERP: It should show what the user typed.
  5. A browser that was not on a default SERP is still not on a default SERP: Nothing should change.
Assignee: nobody → jteow
Attachment #9299613 - Attachment description: WIP: - Bug 1790429 - Change userTypedValue of browers when the default search engine changes - r?adw → Bug 1790429 - Change userTypedValue of browers when the default search engine is changed - r?adw
Status: NEW → ASSIGNED
Attachment #9299613 - Attachment is obsolete: true
Assignee: jteow → nobody
Severity: -- → N/A
Status: ASSIGNED → NEW
Type: task → enhancement
Priority: -- → P3
Whiteboard: [sng]
Blocks: 1939598
Whiteboard: [sng] → [sng-scotchbonnet-followon][scotchbonnet-persistsearchterms]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: