Bug 188800 js errors on addressing pref panel with --disable-ldap, address collection prefs broken

patch by borggraefe@despammed.com r=timeless sr=dmose
This commit is contained in:
timeless%mozdev.org 2003-11-05 21:13:47 +00:00
Родитель b1fee61e78
Коммит 8528d68037
1 изменённых файлов: 18 добавлений и 11 удалений

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

@ -8,11 +8,17 @@ var gNewServerString = null;
var gFromGlobalPref = false;
var gUpdate = false;
var gDeletedDirectories = new Array();
var gLDAPPrefsService;
var gLDAPPrefsService = Components.classes[
"@mozilla.org/ldapprefs-service;1"].getService();
gLDAPPrefsService = gLDAPPrefsService.QueryInterface(
Components.interfaces.nsILDAPPrefsService);
function initLDAPPrefsService()
{
if (gLDAPPrefsService)
return;
const LDAP_PREF_CONTRACT="@mozilla.org/ldapprefs-service;1";
if (LDAP_PREF_CONTRACT in Components.classes)
gLDAPPrefsService = Components.classes[LDAP_PREF_CONTRACT].getService(Components.interfaces.nsILDAPPrefsService);
}
function onEditDirectories()
{
@ -62,7 +68,7 @@ function enableAutocomplete()
// autocompleteSkipDirectory.setAttribute("disabled", true);
}
// if we do not have any directories disable the dropdown list box
if (gAvailDirectories.length < 1)
if (!gAvailDirectories || (gAvailDirectories.length < 1))
directoriesList.setAttribute("disabled", true);
gFromGlobalPref = true;
LoadDirectories(directoriesListPopup);
@ -136,12 +142,13 @@ function LoadDirectories(popup)
}
}
if (!gAvailDirectories) {
try {
arrayOfDirectories = gLDAPPrefsService.getServerList(gPrefInt, prefCount);
}
catch (ex) {
arrayOfDirectories = null;
}
try {
initLDAPPrefsService();
if (gLDAPPrefsService)
arrayOfDirectories = gLDAPPrefsService.getServerList(gPrefInt, prefCount);
}
catch (ex) {
}
if (arrayOfDirectories) {
gAvailDirectories = new Array();
for (var i = 0; i < prefCount.value; i++)