Closed Bug 1679364 Opened 4 years ago Closed 3 years ago

Address Book API should be able to handle and access read-only address books

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

defect

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
85 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(2 files)

Currently the address book API is explicitly excluded from handling read-only address books:

https://searchfox.org/comm-central/rev/709ab8c3e9eecdfe11d848cf717236948b4d6800/mail/components/extensions/parent/ext-addressBook.js#105-107

The limitation seems to have been added when the API was originally implemented, though I don't see a reason as to why. The documentation says that read-only address books are currently ignored, so I suspect this was just for scope limiting initially.

Assignee: nobody → standard8
Status: NEW → ASSIGNED
Depends on: 1679464

This means that UID is generated consistently across restarts for the OS X address book which is read-only.

It also works around an issue where doing a search via extensions would sometimes not have a UID straight away.

Depends on D98006

It also works around an issue where doing a search via extensions would sometimes not have a UID straight away.

Could you explain this a little more? nsAbCardProperty::GetUID creates a value if there isn't already one, so unless something's looking through the card properties, a card should always appear to have a UID.

(In reply to Geoff Lankow (:darktrojan) from comment #3)

It also works around an issue where doing a search via extensions would sometimes not have a UID straight away.

Could you explain this a little more? nsAbCardProperty::GetUID creates a value if there isn't already one, so unless something's looking through the card properties, a card should always appear to have a UID.

I was getting confused as there was different behaviour happening. The problem with nsAbCardProperty::GetUID is that it will also call nsAbCardProperty::SetUID. The SetUID has a check for read-only address books at the end of it:

https://searchfox.org/comm-central/rev/f6b563aaf622ff6fe9836cd8e6ffe9b2851a63b6/mailnews/addrbook/src/nsAbCardProperty.cpp#339-345

That fails - as OS X is a read-only directory. However, at that point, the UID property has already been stored, so the next time we use the UID, it passes (which was confusing me when I first tried to look at it).

I'm going to update the patch to include an explicit nsAbOSXCard::SetUID to fail if someone attempts to set it.

Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/comm-central/rev/66e8e55639b4
Handle read-only address books on the WebExtension APIs. r=darktrojan
https://hg.mozilla.org/comm-central/rev/d3ce9854522e
Use the system-provided UID for OS X address book cards. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

Just to note, I'm not sure this should be uplifted to esr78. This could affect add-ons that have implemented contacts handling already but not taken account of read-only address books.

It might be better to announce it once it gets onto beta, but wait until the next esr for when we fix it (unless there's possibly high demand).

Ok let's set 78 to wontfix for the moment. Can always reconsider later if need be.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: