Closed
Bug 840413
Opened 12 years ago
Closed 11 years ago
browser.search.selectedEngine doesn't work as a default preference
Categories
(Firefox :: Search, defect)
Firefox
Search
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: mkaply, Unassigned)
Details
We've had some enterprise users that wanted to change the default search engine in Firefox.
The logical thing to do was to set the preference
browser.search.selectedEngine in a config file using something like this:
defaultPref("browser.search.selectedEngine", "Bing");
Unfortunately, this doesn't code.
It appears the search code doesn't honor the selectedEngine preference if it is set as a default preference.
It should.
Comment 1•12 years ago
|
||
We don't have a concept of a "default" engine, just "selected engine". We need to create one before this kind of idea makes sense.
| Reporter | ||
Comment 2•12 years ago
|
||
I've come up with ways to work around this, but I keep getting tripped up if the user selects Google (we reset the pref).
This code:
https://mxr.mozilla.org/mozilla-central/source/toolkit/components/search/nsSearchService.js#3550
3548 var currentEnginePref = BROWSER_SEARCH_PREF + "selectedEngine";
3549
3550 if (this._currentEngine == this.defaultEngine) {
3551 Services.prefs.clearUserPref(currentEnginePref);
3552 }
3553 else {
3554 setLocalizedPref(currentEnginePref, this._currentEngine.name);
3555 }
Why are we resetting selectedEngine if engine == the default?
This makes it impossible to try to preset the selected engine without touching defaultenginename because if the user ever selects Google, you get the default again (instead of saving the user's Google choice)
Updated•11 years ago
|
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Comment 4•11 years ago
|
||
We're doing that so that changes in default engine take effect for existing users using the default.
The premise of the question is flawed, I don't see why you'd want to avoid "touching defaultenginename" - that is the supported way of changing search defaults.
Flags: needinfo?(gavin.sharp)
| Reporter | ||
Comment 5•11 years ago
|
||
I need to retest this with the latest search changes.
The primary issue was that it wasn't possible to set the selected engine without changing the default engine.
Now that the three preferences have been merged, it might be different.
| Reporter | ||
Comment 6•11 years ago
|
||
So now that the three prefs are merged, this bug is moot.
Just setting:
defaultPref("browser.search.defaultenginename", "data:text/plain,browser.search.defaultenginename=Bing");
defaultPref("browser.search.defaultenginename.US", "data:text/plain,browser.search.defaultenginename.US=Bing");
Gets the search engine changed for all three cases.
There's no need to set selected engine anymore
Comment 7•11 years ago
|
||
This appears to work fine when using one of the 'known' search engines (Bing, Yahoo etc) - but if I specify a custom search engine that is added via CCK2, I get 'Google' the first time I run Firefox (ESR 31) - have to restart firefox to pick up the custom search engine - which is not a major issue :-)
| Reporter | ||
Comment 8•11 years ago
|
||
The CCK2 has its own builtin method for setting the selected engine. I don't recommend people use the pref with the CCK2.
But that is odd.
You need to log in
before you can comment on or make changes to this bug.
Description
•