Adapt to Changes in Thunderbird 79-91
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 91. If you find changes which are not yet listed on this page, you can ask for help and advice in one of our .
Most usage of nsIArray
and nsIMutableArray
has been replaced by standard JavaScript arrays and functions which returned a nsISimpleEnumerator
have been changed to return a JavaScript array as well. The following APIs have been updated (links to actual patches, showing how core handled the change):
(returns array)
(returns array)
nsIAbDirectory.getCardsFromProperty (returns array)
nsIAbManager.directories (returns array)\
(returns array)
(returns array)
(returns array)
(returns array)\
nsIMsgCompFields.attachments (returns array)\
(has been and now only accepts a single src folder)
(expects an array for the second argument)
nsIMsgFilterCustomAction.getCustomActions (returns array)
(expects an array for the first argument)
(expects an array for the first argument)
(returns array)
(expects an array for the first argument)
(expects an array for the first argument)
(expects an array for the first argument)
(expects an array for the first argument)
(returns array)\
(first parameter is an array)\
nsISmtpService.servers (returns array)
\
The function fixIterator()
is no longer needed by any core code and was subsequently removed together with iteratorutils.jsm
. It was mostly used in the following way:
Since MailServices.accounts.accounts
or MailServices.accounts.allIdentities
return a simple array since Thunderbird 75, there is no need to pipe it through fixIterator()
anymore. If your add-on is multi-version compatible and still supports Thunderbird 68 this has to be dealt with separately.\
Renamed in Beta 80 to SEC_ALLOW_CROSS_ORIGIN_SEC_CONTEXT_IS_NULL
. This is often used as the aSecurityFlags
argument in calls to Services.io.newChannelFromURI()
.
Renamed in Beta 80 to SEC_REQUIRE_SAME_ORIGIN_INHERITS_SEC_CONTEXT
.
Changed in Beta 87. Needs a fifth parameter to specify a nsIDNSRecord
value, but can be null
if not needed:
Has been renamed to nsIMsgCopyService.copyFileMessage
.
Has been renamed to nsIMsgCopyService.copyMessages
.
Has been renamed to nsIMsgCopyService.copyFolder
and no longer accepts an Array of src folders, but a single src folder.
Has been renamed to nsIMsgCopyService.notifyCompletion
.
The file Log4moz.jsm
has been removed in Thunderbird 85. Instead, use console
:
console.debug()
console.log()
console.trace()
- same as console.log()
, but dumps a trace log additionally.
console.info()
console.warn()
console.error()
These basic log functions accept multiple parameters, which are all dumped to the console. For example:
Alternatively,console.createInstance()
allows to define a custom console logger, with a prefix
and a maxLogLevel
. The maxLogLevel
can be used to disable/enable logging in debug or production builds or set the level based on users choice.
The levels Info
, Trace
and Log
are actually identical.
Interface has been dropped in favor of an observer based approach. See
The grid element does not seem to work anymore. Alternative is to use <html:table>.
The ftvItem
object has been renamed to FtvItem
in Beta 86.
Has been replaced by gAttachmentBucket.itemCount
.
Has been replaced by gAttachmentBucket.selectedCount
.
No longer supports the gAlertListener
, gUserInitiated
and gOrigin
parameters when being opened (argument 1-3). Instead, the following parameters are are used now:
Thunderbird can now separate content into different processes, which can only communicate through limited channels. This change has advantages relative to security and performance, but restricts code from freely accessing data that belongs to a different process.
In Thunderbird 91, this is primarily affecting pages belonging to an Add-on, like the background page or frames injected with an experiment. Most other parts of Thunderbird did not (yet!) change as much.
In practical terms, this means that you may need to update your experiments:
As a consequence, if you load JavaScript modules in "child" experiment code, you will now get separate instances of the JSM: each process has its own instance, and there could be multiple child processes. If you keep using JSMs from "child" code, you may furthermore need to manually unload these separate instances on API shutdown (ExtensionAPI.onShutdown
), even if you use a catch-all unloading solution like CachingFix or the WindowListener API.
For example .\
Renamed in Beta 86 to nsIMsgCompose.sendMsg
. It also returns a Promise now. More details can be found .\
See for more details.
The Thunderbird-specific file was removed without a direct replacement. You need to alter your logic or copy code from the old JSM into your add-on. might be a good inspiration, as it contains the changes that were necessary for core code.
Has been replaced by .
Use instead.
Use the dedicated function or instead.
Has been replaced bygAttachmentBucket
. More information can be found .
If you create frames in Thunderbird's UI, these frames now need the appropriate attributes to load content in the right process. You can find an example of required changes in .
If you exchange raw objects between WebExtension scopes / "child" experiment code and Thunderbird / "parent" experiment code, you need to migrate to an indirect approach, usually based on explicit message passing. Depending on the complexity of your task, this can either happen through notifyTools, a custom experiment API or through custom experiment code directly using cross-process APIs (likely either or ).