Closed Bug 1922535 Opened 1 year ago Closed 1 year ago

UrlbarController.speculativeConnect causes warnings when just '@' is typed (getSubmission: searchTerms is empty)

Categories

(Firefox :: Address Bar, defect, P3)

defect

Tracking

()

RESOLVED FIXED
135 Branch
Tracking Status
firefox135 --- fixed

People

(Reporter: standard8, Assigned: adylanmclamb, Mentored)

Details

(Keywords: good-first-bug, Whiteboard: [lang=js])

Attachments

(1 file)

STR

  1. Start up Firefox
  2. Open the Browser Console
  3. Type @ in the address bar

Expected Results

=> No warnings on the console

Actual Results

=> A warning is raised on the console: SearchEngine: getSubmission: searchTerms is empty!

This is coming from UrlbarController.speculativeConnect. When it retrieves the URL via getUrlFromResult there's no payload/query at the time, and so the search service complains that the search term being inserted into the URL is empty.

The intention of this warning is to indicate cases where we might unintentionally be sending the user to a search page with no search query (SearchEngine.searchURLWithNoTerms can be used in the case where we do want to allow it).

I think the main thing here is that we're unnecessarily getting the details of the url when we might not use them. In the case the first result displayed is a search engine result, we're reaching into the search service and formulating the URL. Whilst it isn't very expensive, I'm not sure I see a need to do it when we don't need to.

So the fix here would be to only get the url when we need to - in the couple of places in the case statement where it is actually used.

Please assign this issue to me.

(In reply to Nitesh from comment #1)

Please assign this issue to me.

(In reply to Nitesh from comment #1)

Please assign this issue to me.

You can start working on the patch, and it'll be automatically assigned when the patch is uploaded.

I can't reproduce this bug. I am using Firefox on Ubuntu.

Assignee: nobody → adylanmclamb
Status: NEW → ASSIGNED
Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/298870a5c310 Only get URL when needed in UrlbarController speculativeConnect. r=Standard8,urlbar-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 135 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: