Closed
Bug 1173754
Opened 9 years ago
Closed 9 years ago
Add restrictSearchesToken to allow to use the locationbar as the search bar
Categories
(Firefox :: Address Bar, defect, P3)
Firefox
Address Bar
Tracking
()
RESOLVED
FIXED
Firefox 41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: mak, Assigned: adw)
References
Details
(Whiteboard: [suggestions][fxsearch])
Attachments
(1 file)
9.65 KB,
patch
|
mak
:
review+
|
Details | Diff | Splinter Review |
We should add a restrict token to get only search suggestions, this way the locationbar can be used similarly to the search bar.
This is not critical for first release, since these tokens are undiscoverable, but nice to have for advanced users.
Flags: qe-verify-
Flags: firefox-backlog+
Updated•9 years ago
|
Rank: 37
Assignee | ||
Comment 1•9 years ago
|
||
How's this? Restricting search suggestions is different from restricting everything else because they don't live in the DB. So it seems we need to either make MatchAutoCompleteFunction basically a no-op when restricting to suggestions, or better, just not access the DB at all, so that's what this does. It skips the main queries but still gets the usual first result.
To make the test pass, I had to change the search string passed to getSuggestionController from _originalSearchString to _searchTokens.join(" "). Otherwise the autocomplete results had $ in them. However, when I tested the patch manually with _originalSearchString, there were no $ in the results. So in other words, manual testing showed that using _originalSearchString and _searchTokens.join(" ") produced the same, apparently correct, results, but the former broke the test.
Reporter | ||
Comment 2•9 years ago
|
||
Comment on attachment 8624947 [details] [diff] [review]
patch
Review of attachment 8624947 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
@@ +2,5 @@
>
> const ENGINE_NAME = "engine-suggestions.xml";
> const SERVER_PORT = 9000;
> const SUGGEST_PREF = "browser.urlbar.suggest.searches";
> +const SUGGEST_RESTRICT_TOKEN = "$";
better to read it from the pref, in case we neeed to change it for whatever reason (localization, accessibility, ecc).
@@ +222,5 @@
> + }),
> + title: ENGINE_NAME,
> + style: ["action", "searchengine"],
> + icon: "",
> + }, {
very-nit: you used different style of bracing separation in the above object and here "},\n{" vs "}, {" as well as different indentation for "[{" vs "[\n{".
Attachment #8624947 -
Flags: review?(mak77) → review+
Assignee | ||
Comment 3•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/38c71cf56b27
(In reply to Marco Bonardo [::mak] from comment #2)
> ::: toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
> @@ +2,5 @@
> >
> > const ENGINE_NAME = "engine-suggestions.xml";
> > const SERVER_PORT = 9000;
> > const SUGGEST_PREF = "browser.urlbar.suggest.searches";
> > +const SUGGEST_RESTRICT_TOKEN = "$";
>
> better to read it from the pref, in case we neeed to change it for whatever
> reason (localization, accessibility, ecc).
My understanding is that firefox.js prefs aren't set in the xpcshell environment. Indeed when I try to get the pref in the test, it fails. So I left this part. If there's something obvious I'm missing I'd be glad to do a quick follow-up.
> very-nit: you used different style of bracing separation in the above object
> and here "},\n{" vs "}, {" as well as different indentation for "[{" vs
> "[\n{".
You're right, fixed.
The previous patch was based on my patch in bug 1176107 by the way, so I rebased before landing.
Reporter | ||
Comment 4•9 years ago
|
||
(In reply to Drew Willcoxon :adw from comment #3)
> https://hg.mozilla.org/integration/fx-team/rev/38c71cf56b27
>
> (In reply to Marco Bonardo [::mak] from comment #2)
> > ::: toolkit/components/places/tests/unifiedcomplete/test_searchSuggestions.js
> > @@ +2,5 @@
> > >
> > > const ENGINE_NAME = "engine-suggestions.xml";
> > > const SERVER_PORT = 9000;
> > > const SUGGEST_PREF = "browser.urlbar.suggest.searches";
> > > +const SUGGEST_RESTRICT_TOKEN = "$";
> >
> > better to read it from the pref, in case we neeed to change it for whatever
> > reason (localization, accessibility, ecc).
>
> My understanding is that firefox.js prefs aren't set in the xpcshell
> environment. Indeed when I try to get the pref in the test, it fails. So I
> left this part. If there's something obvious I'm missing I'd be glad to do
> a quick follow-up.
oh right, nevermind.
Comment 5•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 41
You need to log in
before you can comment on or make changes to this bug.
Description
•