зеркало из https://github.com/mozilla/pjs.git
Bug 72752, The default search engine will pick up AltaVista TradChinese, r=nhotta, sr=alecf
This commit is contained in:
Родитель
5e3b884be7
Коммит
387dccb716
|
@ -27,7 +27,44 @@ function checkEngine()
|
|||
{
|
||||
var engineList = document.getElementById("engineList");
|
||||
var engineValue = engineList.label;
|
||||
|
||||
//nothing is selected
|
||||
if (!engineValue)
|
||||
engineList.selectedIndex = 6;
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var prefInt = null; //Preferences Interface
|
||||
var strDefaultSearchEngineName;
|
||||
|
||||
prefInt = Components.classes["@mozilla.org/preferences;1"];
|
||||
if (prefInt)
|
||||
{
|
||||
prefInt = prefInt.getService(Components.interfaces.nsIPref);
|
||||
strDefaultSearchEngineName = prefInt.getLocalizedUnicharPref("browser.search.defaultenginename");
|
||||
}
|
||||
|
||||
var engineListSelection = engineList.getElementsByAttribute( "label", strDefaultSearchEngineName );
|
||||
var selectedItem = engineListSelection.length ? engineListSelection[0] : null;
|
||||
|
||||
if (selectedItem)
|
||||
{
|
||||
//select a locale-dependent predefined search engine in absence of a user default
|
||||
engineList.selectedItem = selectedItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
//select the first listed search engine
|
||||
engineList.selectedIndex = 1;
|
||||
}
|
||||
}
|
||||
|
||||
catch(e)
|
||||
{
|
||||
//select the first listed search engine
|
||||
engineList.selectedIndex = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче