Bug 358891: Firefox doesn't remember the search engine with non-ascii characters as its selected engine, patch by Kohei Yoshino <kohei.yoshino.bugs@gmail.com>, r=me

git-svn-id: svn://10.0.0.236/trunk@214466 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2006-10-31 15:32:43 +00:00
parent e69dddc309
commit 91c2dcfe29

View File

@@ -627,6 +627,23 @@ function getLocalizedPref(aPrefName, aDefault) {
return aDefault;
}
/**
* Wrapper for nsIPrefBranch::setComplexValue.
* @param aPrefName
* The name of the pref to set.
*/
function setLocalizedPref(aPrefName, aValue) {
var prefB = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
const nsIPLS = Ci.nsIPrefLocalizedString;
try {
var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
.createInstance(Ci.nsIPrefLocalizedString);
pls.data = aValue;
prefB.setComplexValue(aPrefName, nsIPLS, pls);
} catch (ex) {}
}
/**
* Wrapper for nsIPrefBranch::getBoolPref.
* @param aPrefName
@@ -2774,7 +2791,7 @@ SearchService.prototype = {
prefB.clearUserPref(currentEnginePref);
}
else {
prefB.setCharPref(currentEnginePref, this._currentEngine.name);
setLocalizedPref(currentEnginePref, this._currentEngine.name);
}
notifyAction(this._currentEngine, SEARCH_ENGINE_CURRENT);