Closed Bug 1481319 Opened 6 years ago Closed 6 years ago

"http://x" incorrectly loads search bookmark with keyword "x"


(Firefox :: Address Bar, defect, P2)




Firefox 63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed


(Reporter: mbrubeck, Assigned: mbrubeck)



(Keywords: regression, Whiteboard: [fxsearch])


(1 file)

Steps to reproduce:

1. Create a bookmark with URL "" and keyword "foobarbaz".
2. Type "http://foobarbaz" into the location bar and press Enter.

Expected result:

* Firefox navigates to the URL "http://foobarbaz".

Actual result:

* Firefox navigates to the URL "" (note that "foo" is cut off).
This is happening at this line:

`this._searchTokens[0]` contains the URL after its prefix was stripped ("foobarbaz"), while `this._trimmedOriginalSearchString` contains the whole URL including the prefix ("http://foobarbaz").  The line above attempts to strip off the keyword, but doesn't account for the length of the prefix, so it strips the first 10 characters ("http://foo") leaving "barbaz".
Component: Places → Address Bar
Priority: -- → P2
Product: Toolkit → Firefox
Whiteboard: [fxsearch]
This patch restores the stripped prefix before matching against bookmark keywords.  This means that entering "foo:bar" will no longer activate a bookmark with keyword "bar", but it will now match a bookmark with keyword "foo:bar".

Alternately, this function could simply return false if the original search string contains any keyword.  This would make it impossible to use any keyword that contains ":".
Assignee: nobody → mbrubeck
It was gradually broken.
Before landing of  Bug 1306639, Firefox navigates to "http://foobarbaz" as expected.
Between landing of Bug 1306639 and Bug 1310737, Firefox navigates to "".
After landing of  Bug 1310737, Firefox navigates to ""

#1 regression window(Firefox navigates to ""):

Regressed by: 70d19ed29c98	Marco Bonardo — Bug 1306639 - Searching in locationbar by typing something and pressing enter is not accounted in telemetry. r=adw

#2 regression window(Firefox navigates to ""):

Regressed by: 74b268465bc7	Marco Bonardo — Bug 1310737 - Urlbar doesn't properly handle %S and POST keywords. r=adw
Thank you for checking the range.
Comment on attachment 8998037 [details]
Bug 1481319 - Include prefix when matching bookmark keywords. r?mak

Marco Bonardo [::mak] (Away 9-26 Aug) has approved the revision.
Attachment #8998037 - Flags: review+
Pushed by
Include prefix when matching bookmark keywords. r=mak
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Given how old the regression is, doesn't seem worth backporting to ESR60. Did you want to nominate for Beta approval?
Flags: needinfo?(mbrubeck)
Flags: in-testsuite+
I don't think this is critical to backport to beta, but I'll defer to mak if thinks we should.
Flags: needinfo?(mbrubeck)
yep, not critical, it's an edge case.
You need to log in before you can comment on or make changes to this bug.