Note: There are a few cases of duplicates in user autocompletion which are being worked on.

Contacts without e-mail addresses break mailing lists



MailNews Core
Address Book
8 years ago
7 years ago


(Reporter: pi, Unassigned)


Firefox Tracking Flags

(Not tracked)



(2 attachments)



8 years ago
Created attachment 377071 [details]
JS to reproduce the exceptions

When working on my extension I kept breaking directories from syncing contacts without e-mail addresses to mailing lists.  It is the leading subject in e-mail and comments about my extension because it can be caused by dragging and dropping contacts into a mailing list as well.  It now adds a fake e-mail address to contacts added to mailing lists by overriding the abDirTreeObserver.onDrop and CheckAndSetCardValues methods (among others), but can still miss some cases.

After the contact is added to this list, calling hasMoreElements on an nsISimpleEnumerator of the list's childCards fails with NS_ERROR_FAILURE, and calls to nsIAbDirectory.addCard fail with NS_ERROR_INVALID_POINTER.  See the attachment for a line to evaluate in the Error Console. It only works in Thunderbird 3.0b1pre and above, but I can attach one for 2 as well.

I can reproduce the error in Thunderbird, 3.0b3pre, and 3.1a1pre.

The main problem lies in nsAddrDatabase::AddListCardColumnsToRow on line 1359 [0].  It checks if the contact has an e-mail address and just returns NS_OK if not.

I know it defeats the original purpose of a mailing list, but allowing contacts without e-mail addresses would be nice for extensions at least.  This, however, would require a more complicated patch since duplicate e-mail addresses won't work in mailing lists.

Otherwise, returning an error would allow extensions to catch it and add a fake e-mail address.


Comment 1

8 years ago
Created attachment 377076 [details] [diff] [review]
A patch that allows one contact w/o an e-mail address per list

This is just a sample patch (not for review) that allows contacts without an e-mail address to be added to a mailing list.

Due to the unique e-mail restriction this still won't allow multiple contacts without e-mail addresses in the same list.

Comment 2

8 years ago
I have managed to get the NS_ERROR_INVALID_POINTER when exporting, deleting, then importing an address book with mailing lists without restarting Thunderbird.  The import was unable to add the contact to the list, but I didn't see anything in a debug build until I tried to manually add the contact.
Last Resolved: 7 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 248786
You need to log in before you can comment on or make changes to this bug.