Closed Bug 188800 Opened 22 years ago Closed 21 years ago

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

Categories

(MailNews Core :: LDAP Integration, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: tuukka.tolvanen, Assigned: Stefan.Borggraefe)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3a) Gecko/20030107 Phoenix/0.5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030112

In my builds with --disable-ldap, displaying the mail>addressing pref panel
gives the following errors on js console:

--------------------------------
Warning: reference to undefined property
Components.classes['@mozilla.org/ldapprefs-service;1']
Source File: chrome://messenger/content/addressbook/pref-directory.js
Line: 12

Warning: reference to undefined property
Components.classes['@mozilla.org/ldapprefs-service;1']
Source File: chrome://messenger/content/addressbook/pref-directory.js
Line: 12

Error: Components.classes['@mozilla.org/ldapprefs-service;1'] has no properties
Source File: chrome://messenger/content/addressbook/pref-directory.js
Line: 12

Error: gAvailDirectories has no properties
Source File: chrome://messenger/content/addressbook/pref-directory.js
Line: 65
--------------------------------

The email collection prefs on the panel don't stick -- changing them, hitting OK
and reopening prefs reverts them. Building without --disable-ldap fixes these
issues.

Reproducible: Always

Steps to Reproduce:
1. build with --disable-ldap
2. menu: edit > prefs > mail > addressing
 -> above 4 js errors
3. change address collection prefs, hit ok
4. bring up the pref panel again
 -> changed prefs reverted
Actual Results:  
js errors, prefs reverted

Expected Results:  
no js errors, pref changes retained
We need some try/catch blocks here...
Attached patch Patch (obsolete) — Splinter Review
Fixes the bug. Is there a way to avoid the JS strict warning, too?
Attachment #133483 - Flags: review?(timeless)
Comment on attachment 133483 [details] [diff] [review]
Patch

it occurs to me that i probably have a tree with this patched...

anyway, if you use this in your init function people should be happier:
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.nsILDAP
PrefsService);
Attachment #133483 - Flags: review?(timeless) → review-
oh and you should only call the function if the object is non null:
if (gLDAPPrefsService)
  arrayOfDirectories = gLDAPPrefsService.getServerList(gPrefInt, prefCount);
Assignee: srilatha → borggraefe
Attached patch Updated PatchSplinter Review
Attachment #133483 - Attachment is obsolete: true
Attachment #133512 - Flags: review?(timeless)
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → mozilla1.6alpha
Attachment #133512 - Flags: superreview?(dmose)
Attachment #133512 - Flags: review?(timeless)
Attachment #133512 - Flags: review+
Comment on attachment 133512 [details] [diff] [review]
Updated Patch

sr=dmose@mozilla.org
Attachment #133512 - Flags: superreview?(dmose) → superreview+
Thanks for checking this in, timeless! :-)

Marking FIXED.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: