Closed Bug 1721807 Opened 3 years ago Closed 3 years ago

Address Book search returns no results if an record contains a null value

Categories

(MailNews Core :: Address Book, defect)

defect

Tracking

(thunderbird91 fixed)

RESOLVED FIXED
92 Branch
Tracking Status
thunderbird91 --- fixed

People

(Reporter: samantham, Assigned: samantham)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:92.0) Gecko/20100101 Firefox/92.0

Steps to reproduce:

I add a CardDAV address book. Then I go to the Address Book of Thunderbird. All the emails appear listed. I select the CardDAV address book, then enter text into the search form and press enter.

Actual results:

Empty results, or blank entries are returned.

Error shows up in Developer Tools which says:

JavaScript error: resource:///modules/AddrBookDirectory.jsm, line 307: TypeError: can't access property "toLowerCase", properties.get(...) is null
JavaScript error: chrome://messenger/content/addressbook/abView.js, line 23: NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "can't access property "toLowerCase", properties.get(...) is null" {file: "resource:///modules/AddrBookDirectory.jsm" line: 307}]'
[JavaScript Error: "can't access property "toLowerCase", properties.get(...) is null" {file: "resource:///modules/AddrBookDirectory.jsm" line: 307}]' when calling method: [nsIAbDirectory::search]

If I print out the property value, I get the following (note the null value for FirstName).
{ DisplayName → "Last, First", _vCard → "BEGIN:VCARD\r\nVERSION:3.0\r\nN:First;Last,;;;\r\nFN:Last, First\r\nEMAIL;TYPE=INTERNET;TYPE=OTHER:email@email.com\r\nUID:${UID}\r\nEND:VCARD\rNULL\n", PopularityIndex → "0", PrimaryEmail → "email@email.com", _etag → ""${etag}"", FirstName → null, LastName → "First", PreferMailFormat → "0", LastModifiedDate → "0", _href → "/addressbooks/samantham/default/${UID}.vcf" }

Expected results:

The correct results appear.

Without this check, an exception occurs if the value we try and match is null.
Change it so we have the same behavior as if the key did not exist.

Assignee: nobody → samantham

N:First;Last,;;;

That's interesting. We parse this badly because of the comma. It's probably not supposed to be there according to the VCard spec, but we should handle it better than we do.

I'm going to have a closer look into this before approving your patch, which is probably fine but I want to know exactly how we get a null value stored in the first place.

Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Product: Thunderbird → MailNews Core
Version: Trunk → unspecified
See Also: → 1721946
Attachment #9232619 - Attachment description: Bug 1721807 - Check AddressBook value isn't null before comparing r=darktrojan → Bug 1721807 - Check AddressBook value isn't falsy before comparing r=darktrojan

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/24234fc0a9aa
Check AddressBook value isn't falsy before comparing r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED

Patch landed. First one, I believe? Well done, and thanks.

Target Milestone: --- → 92 Branch

Comment on attachment 9232619 [details]
Bug 1721807 - Check AddressBook value isn't falsy before comparing r=darktrojan

[Triage Comment]
Taking for 91b4

Attachment #9232619 - Flags: approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: