Adapt to Changes in Thunderbird 92-102
Last updated
Was this helpful?
Last updated
Was this helpful?
This document tries to cover all the internal changes that may be needed to make Experiment add-ons compatible with Thunderbird 102. If you find changes which are not yet listed on this page, you can ask for help and advice in one of our .
Some developers use the version string to determine which function to call in add-ons which try to be backward compatible. For example:
This fails for Thunderbird 100 and newer, because this is a string comparison and not an integer comparison. A function to get the integer values could look like so:
And then just use getThunderbirdVersion().major >= 91
to check the version.
In this specific case, one could also use feature detection itself:
The class headerName
used for the styling header entries has been renamed to message-header-label
. The classmessage-header-row
has been added, styling the entire row.
The class msgHeaderView-button
used to style toolbar buttons has been renamed to message-header-view-button
.
This stringbundle
element has been removed from messageWindow.xhtml
and messenger.xhtml
. To access the strings, you have to load the bundle directly:
The method to retrieve strings from the created bundle is slightly different, instead of getString()
use GetStringFromName()
.
getItem()
addItem()
adoptItem()
modifyItem()
deleteItem()
deleteOfflineItem()
getItemOfflineFlag()
The former methods to promisify these functions have been removed together with calAsyncUtils.jsm
. Additionally, the getItem()
method will return the item directly instead of an array with the item. Replace
by
The calIOperationListener
and calIOperation
interfaces are still used in various places but the general direction is to remove them eventually after 102 in favor of Promises and ReadableStreams. If you have code that uses them internally, please update where feasible.
Calendar providers need to change above mentioned functions to be asynchronous. Calling the listeners is no longer necessary. Instead, you should return the item from the addItem
/adoptItem
/modifyItem
functions and make sure to throw an error in case of failure.
For providers with offline support, you need to call listeners set by the cache layer using the _cachedAdoptItemCallback
and _cachedModifyItemCallback
properties on your provider class. This is an unfortunate hack needed to maintain the order the onAddItem
event is fired by calCachedCalendar
. These listeners need to be called just before returning.
Note: It is important to store the callbacks before executing any async work to avoid issues when the same operation is run in concurrently. See the example below.
Since Thunderbird 96, calICalendar.getItems()
returns a ReadableStream
. Replace
by
If you are implementing a provider you will need to adapt your code to return a ReadableStream
. For cached providers, ensure you are returning the result from the offline cache:
This is a new addition to the API that returns the results as an array instead of a ReadableStream
. The BaseClass
provider has a default implementation however providers not extending it should provide their own implementation. If you intend to use this method, please be careful about memory usage with large queries.
Since Thunderbird 96, this function returns a Promise. Replace
by
ChromeUtils.import()
Since Thunderbird 101, it is no longer possible to load JSMs via extension URLs, for example
This method has been removed in 102.3.0. Replace its former usage
by
NotificationBox.appendNotification()
with this
The interface itself has not changed much, but contact details are handled differently now. Instead of storing the individual contact details as key/value pairs, they are now stored as a vCard string in the _vCard
property. The interface has gained two new members:
supportsVCard
a boolean value indicating support for vCard (or lack thereof).
vCardProperties
is a VCardProperties
object if the card supports vCard, or null
The new AddrBookCard
object is a wrapper for nsIAbCard
to enable support for vCards. No longer use nsIAbCard
to create a new card:
Instead, create an AddrBookCard
:
To update a card, create a new AddrBookCard
from the updated vCard string and enforce the same UID:
Alternativly, modify the card's vCardProperties
:
After an AddrBookCard
has been created, its vCardProperties
object is populated on first access from the cards _vCard
string property. While saving the card, its _vCard
string property is re-generated from its vCardProperties
.
This effectivly means that all changes to the _vCard
string property after its vCardProperties
object has been used, are ignored.
Read more about the address book implementation in Thunderbirds core documentation:
Has been removed in Thunderbird 93. One of its use case was to compare locale strings. You can replace the following:
by
The method getURLSpecFromFile
has been replaced by getURLSpecFromActualFile
and getURLSpecFromDir
in Thunderbird 92. Use the variant which fits your file
object.
Its generic callback functions have been renamed from onItem*()
to onFolder*()
in Thunderbird 94. Where needed, dedicated onMessage*()
callback functions have been added:
OnItemAdded(in nsIMsgFolder aParentItem, in nsISupports aItem) -> onFolderAdded(in nsIMsgFolder parent, in nsIMsgFolder child) -> onMessageAdded(in nsIMsgFolder parent, in nsIMsgDBHdr msg)
OnItemRemoved(in nsIMsgFolder aParentItem, in nsISupports aItem) -> onFolderRemoved(in nsIMsgFolder parent, in nsIMsgFolder child) -> onMessageRemoved(in nsIMsgFolder parent, in nsIMsgDBHdr msg)
The following callback functions were renamed without changing their parameters:
OnItemEvent -> onFolderEvent
OnItemPropertyChanged -> onFolderPropertyChanged
OnItemIntPropertyChanged -> onFolderIntPropertyChanged
OnItemBoolPropertyChanged -> onFolderBoolPropertyChanged
OnItemUnicharPropertyChanged -> onFolderUnicharPropertyChanged
OnItemPropertyFlagChanged -> onFolderPropertyFlagChanged
Has been renamed to nsIMsgCompSendFormat.Auto
in Thunderbird 101.
The parameters of this listener have been changed in Thunderbird 102. The header messageId has been added:
A few members and methods have been removed without replacement:
isPrintSelectionRBEnabled
(see alternative described in the following section)
isCancelled
saveOnCancel
showPrintProgress
SetupSilentPrinting()
Has been replaced by nsIPrintDialogService.*
.
The function showPrintDialog()
has also been updated to accept a new parameter to indicate if the entire document or just the current selection should be printed (replacement for the removed nsIPrintSettings.isPrintSelectionRBEnabled
).
The parameters of this function have changed: It is now possible to specify, which msgHdr is to be displayed. To open the currently selected message, update your usage from
to
Since Thunderbird 97, the JSM no longer exports a set of functions but a single object. The file has also been renamed from folderUtils.jsm
to FolderUtils.jsm
. Replace this former usage:
by
or use the FolderUtils namespace to access its functions.
The id of the editor element in the composer has been renamed from to .
The id of the additional header area in the message display window has been renamed from to . The element has also been converted from a table
to a div
.
Since Thunderbird 96, . This includes:
If your code is synchronous, you will have to rework it to make use of asynchronous functions. Feel free to reach out for further help on this through our .
It is now mandatory to register an internal URL, for example a resource://
URL. See our .
The parameters have in Thunderbird 94. Most former properties have moved into an object. Replace this
All former standard contact properties (now referred to as ) are migrated into the vCard string and can no longer be updated directly via card.setProperty()
. A limited set of banished properties can still be read from: DisplayName
, FirstName
, LastName
, PrimaryEmail
, SecondEmail
, and NickName
.
contains a number of utility functions for converting between the storage types:
The new parameter has been added at the first position to , which already return the messageId.
Instead of printToFile
, use with a value from .