Closed Bug 1659128 Opened 4 years ago Closed 4 years ago

Search mode is not exited when clicking a link or loading a page in the current tab

Categories

(Firefox :: Address Bar, defect, P2)

defect
Points:
3

Tracking

()

VERIFIED FIXED
81 Branch
Iteration:
81.2 - Aug 10 - Aug 23
Tracking Status
firefox81 --- disabled
firefox82 --- verified

People

(Reporter: itiel_yn8, Assigned: adw)

References

(Regressed 1 open bug)

Details

Attachments

(2 files)

Attached image Screenshot

STR:

  1. Open a new tab
  2. Type something in the urlbar
  3. Click the "Tabs" one-off button
  4. Click a top site tile from the new tab page

AR:
The top site is opened, but the "Tabs" search mode still appears on the urlbar

ER:
No "Tabs" label box

Ah... of course, we need to exit search mode when the tab navigates to anything, period. We currently clear it when you use the urlbar to navigate, but not when you click something in the page, for example, and there are probably other cases. Nice catch, thank you!

Severity: -- → S3
Points: --- → 2
Priority: -- → P2
Summary: Clicking a top site from the new tab page while typing search terms in the urlbar (when searching in the e.g. open tabs) makes the search mode label box appear in the urlbar → Search mode is not exited when clicking a link in the current tab
Assignee: nobody → adw
Status: NEW → ASSIGNED
Iteration: --- → 81.2 - Aug 10 - Aug 23

We need to exit search mode when a page loads in the current tab. We may need to
exit search mode for page loads in other tabs too: If you're in search mode,
click a slow link, switch tabs, and the page loads in the meantime, then search
mode should be not be entered when you switch back. I don't think we handle that
case correctly right now, and this patch doesn't address that at all. That's
worth doing in another bug because I think the fix will be different.

At first I added an onLocationChange method to UrlbarInput that was called by
XULBrowserWindow.onLocationChange in browser.js [1], just like we have an
onLocationChange in UrlbarProviderSearchTips called by
XULBrowserWindow.onLocationChange. But we need to potentially exit search mode
any time input.setURI is called. setURI happens to be called by
XULBrowserWindow.onLocationChange, one of the several places that calls it
[2].

setURI is also called when switching tabs. Bug 1647899 already took care of
handling search mode for tab switches, but it would be nice to handle all this
in one place. setURI is also how userTypedValue is restored in the input,
and of course userTypedValue is something we need to restore when switching
tabs, just like search mode. For these reasons I moved per-tab search mode
restoration to setURI as part of this.

I'm also changing the name of the second parameter in setURI. I wasn't sure
whether it's true iff we're switching tabs, so I tracked down why that param was
added. It was added in bug 1478348, and comment 21 confirms it was added to tell
setURI and XULBrowserWindow.onLocationChange when they're being called due
to a tab switch. To make this clearer, I renamed the param and added some
javadoc for XULBrowserWindow.onLocationChange.

[1] https://searchfox.org/mozilla-central/rev/50cb0892948fb4291b9a6b1b30122100ec7d4ef2/browser/base/content/browser.js#5205
[2] https://searchfox.org/mozilla-central/search?q=symbol:%23setURI&redirect=false

Points: 2 → 3
Attachment #9170174 - Attachment description: Bug 1659128 - Exit search mode when input.setURI is called. → Bug 1659128 - Exit search mode as appropriate when input.setURI is called.
Pushed by dwillcoxon@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/80a0f9475989
Exit search mode as appropriate when input.setURI is called. r=harry
Summary: Search mode is not exited when clicking a link in the current tab → Search mode is not exited when clicking a link or loading a page in the current tab
Regressions: 1659610
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
Regressions: 1659748

I verified this issue using 82.0a1 (2020-09-14) on macOS 10.13 and Windows 10 x64.
Adrian could you help me with Ubuntu verification?

Flags: needinfo?(adrian.florinescu)

I verified this issue using 82.0a1 (2020-09-15) on Ubuntu 20.04. Taking in account comment 8 and comment 9 marking this as verified.

Status: RESOLVED → VERIFIED
Flags: needinfo?(adrian.florinescu)
Regressions: 1792634
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: