Introduce accountManager and use messageManager where possible
Categories
(Thunderbird :: Add-Ons: Extensions API, task)
Tracking
(thunderbird_esr115 wontfix)
| Tracking | Status | |
|---|---|---|
| thunderbird_esr115 | --- | wontfix |
People
(Reporter: john, Assigned: john)
References
Details
Attachments
(1 file)
| Assignee | ||
Comment 1•2 years ago
|
||
Depends on D190092
Updated•2 years ago
|
| Assignee | ||
Comment 2•2 years ago
•
|
||
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.
Updated•2 years ago
|
| Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
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
Description
•