Closed Bug 608198 Opened 14 years ago Closed 14 years ago

Prefixing text in the location bar with "?" includes that in the search

Categories

(Firefox :: Address Bar, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 4.0b8
Tracking Status
blocking2.0 --- final+

People

(Reporter: mossop, Assigned: Gavin)

References

Details

(Keywords: regression)

Attachments

(1 file)

It used to be the case that putting a ? before what you typed into the location bar forced a search of the following test using keyword.URL however the ? was not included in the search. Now it is getting included.
This is irritating when you need to use this to force a search for a string that normally would resolve to a website.
blocking2.0: --- → ?
Looks broken. Blocking+. Anyone know what could've caused this (and the tests still passing)?
blocking2.0: ? → final+
OS: Mac OS X → All
Hardware: x86 → All
(In reply to comment #2)
> Looks broken. Blocking+. Anyone know what could've caused this (and the tests
> still passing)?
Not offhand.  I don't recall anything changing with the keyword code recently...
keyword.URL was changed when disabling browse by name.

Just checking though, "?" wasn't a bookmark keyword or a search engine keyword? It was some special hardcoded token?
Yes it was hardcoded in the docshell fixup stuff somewhere.
cc'ing gavin, since he made the docshell changes for disabling browse-by-name.
One thing that changed is that it doesn't seem to be hitting that code I linked in comment 6. That code appends the keyword whereas trunk seems to be inserting it in the middle:

var {classes:Cc,interfaces:Ci}=Components; Components.classes["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup).createFixupURI("? foo", 1).spec

http://www.google.com/search?q=%3F+foo&ie=utf-8&...
Depends on: 586821
Oh hehe. keyword.URL is empty ;)

Mossop: If you set this, do you get the original behavior?

keyword.URL;http://www.google.com/search?ie=UTF-8&oe=UTF-8&sourceid=navclient&q=
Yeah that'd be the problem
(In reply to comment #9)
> Oh hehe. keyword.URL is empty ;)

keyword.URL was intentionally changed to empty, since we want the dynamically set affiliate bits in the URL.
(In reply to comment #11)
> (In reply to comment #9)
> > Oh hehe. keyword.URL is empty ;)
> 
> keyword.URL was intentionally changed to empty, since we want the dynamically
> set affiliate bits in the URL.

Right, but as it stands since bug 586821 if there is no keyword.URL then MangleKeywordIntoURI is never called and so the special handling of the ? prefix doesn't happen.
Assignee: nobody → gavin.sharp
Attached patch patchSplinter Review
The main change is to just always do the "?"-removal and space-trimming, regardless of which path is taken (search service or pref value).

Also updated browser_keywordSearch to mostly cover nsDefaultURIFixup::KeywordToURI (it's under browser because it depends on Firefox-specific behavior details - don't really want to do the work to remove that dependency).

Aside: the test was kind of busted (used nsIWebProgressListener.NOTIFY_STATE_DOCUMENT which doesn't exist, which didn't matter because of bug 608628), but that was only exposed when I made it do more than one load, so I had to fix that too.
Attachment #487258 - Flags: review?(bzbarsky)
Comment on attachment 487258 [details] [diff] [review]
patch

r=me
Attachment #487258 - Flags: review?(bzbarsky) → review+
https://hg.mozilla.org/mozilla-central/rev/4c55c33b49d3
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 4.0b8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: