Closed Bug 1858109 Opened 2 years ago Closed 2 years ago

Introduce accountManager and use messageManager where possible

Categories

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

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
120 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: john, Assigned: john)

References

Details

Attachments

(1 file)

No description provided.
Blocks: 1857631
Assignee: nobody → john
Status: NEW → ASSIGNED

This bug was triggered by Bug 1857631, which needs access to the ExtensionData inside convertFolder(). I decided to move the convertFolder() function into the FolderManager class, which already has the ExtensionData stored as its extension member.

I found a few other places, where the ExtensionData is not available, and therefore also moved convertMessage() and convertAccount() into their manager classes (with AccountManager being new).

The additional advantage here is that we no longer have to check for permissions to see if the extension has access to folders, accounts or messages before using these functions, but the managers are simply not available if the permission is missing (and the code throws notably). I found a couple of such situations and had to change tests and give them the missing permissions to make them pass again, because the old code wrongly granted access due to the missing permission checks.

I also extended the caching concept I already started to use with the CachedMessage class: When add-on code is listening for core events (folder moves etc), we want to convert the exact returned nsIMsgFolder or nsIMsgAccount values. But due to async code, the conversion inside the API implementation (where ExtensionData is available) could already be dealing with a changed object and not returning the correct values. We therefore performed the conversion already inside the core listeners, but there we do not have access to the ExtensionData. The old code had one hack to get around that, where the permission check was delayed. I removed that now. Instead, we cache folders and accounts now inside core listeners and convert the cached value later.

Attachment #9357594 - Attachment description: Bug 1858109 - Introduce accountManager and use messageManager where possible. r=#thunderbird-reviewers → Bug 1858109 - Introduce accountManager, move convert functions into the manager classes and use the manager classes where possible. r=#thunderbird-reviewers
Target Milestone: --- → 120 Branch

Pushed by john@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/909679d3b807
Introduce accountManager, move convert functions into the manager classes and use the manager classes where possible. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: