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

This commit is contained in:
gavin%gavinsharp.com 2006-10-31 15:32:43 +00:00
Родитель 2e175a6e41
Коммит 074c145b9d
1 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -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);