UrlbarController.speculativeConnect causes warnings when just '@' is typed (getSubmission: searchTerms is empty)
Categories
(Firefox :: Address Bar, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox135 | --- | fixed |
People
(Reporter: standard8, Assigned: adylanmclamb, Mentored)
Details
(Keywords: good-first-bug, Whiteboard: [lang=js])
Attachments
(1 file)
STR
- Start up Firefox
- Open the Browser Console
- 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.
(In reply to Nitesh from comment #1)
Please assign this issue to me.
| Reporter | ||
Comment 3•1 year ago
|
||
(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.
| Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
Comment 7•1 year ago
|
||
| bugherder | ||
Description
•