Adapt to Changes in Thunderbird 61-68
Last updated
Was this helpful?
Last updated
Was this helpful?
This document tries to cover all the changes that may by needed to make add-ons compatible with Thunderbird 68. If you find stuff that is no longer working but is not yet on this list, check our .
The changes are grouped by category and are listed in the order we became aware of them.
A bunch of global variables available in some window scopes were removed. If you have used any of these, there are still available as the same names underneath Components.interfaces.
nsMsgFolderFlags
nsIMsgCompDeliverMode
nsIMsgCompSendFormat
nsIMsgCompConvertible
nsIMsgCompType
nsIMsgCompFormat
nsIAbPreferMailFormat
nsIPlaintextEditorMail
nsISupportsString
mozISpellCheckingEngine
XBL is on death row. Many XBL bindings have been replaced or simply no longer exist. The remainder are being removed. This may result in slight behavior changes for some UI components.
Some XUL elements (or some of their attributes) no longer exist and must be replaced by an HTML element or some other XUL element. It does not matter, if you use these elements in a XUL file (as in overlay extensions) or create them via JavaScript (as in bootstrapped extensions).
In order to use HTML elements in a XUL file, you must load the HTML namespace into your overlay or dialog:
Removed. Use
Removed. Use
All <listbox>
related elements have been removed. Use instead. A <richlistbox>
does not support cells or columns, just one <richlistitem>
per row (which can contain multiple other elements like hbox
, vbox
, label
or image
elements)
Furthermore, a few dedicated listbox/richtlistbox
methods have been removed and can be replaced as follows:
listbox.appendItem(label, value)
:
listbox.insertItemAt(index, label, value)
:
listbox.removeItemAt(index)
:
Removed. Use
All preference related XUL elements have been removed. If you have something like this in your add-on:
it must be replaced by a dialog
as follows:
Per default, all preferences will be saved instantly after they have been changed. If you want to postpone saving until the user clicks the OK button, add a type
attribute and a cancel button to the dialog:
Both elements have been removed. To load and access your own string property files, include the following in your JavaScript:
Both elements are deprecated and its usage in Thunderbird is removed. They can be replaced by hbox
elements with an appropriate class
identifier:
You may actually use other elements besides hbox
as a replacement for the statusbarpanel
, like label
or image
.
An editable menulist can also be created via JavaScript:
Even though the menupopup
element is defined as a direct child of the menulist
element in the above example, it cannot be accessed by
anymore. You may assign its own ID to the menupop
element, or get it by
You may use the inspector of the developer tools to see the full DOM structure of the menulist
element.
These two do not display as before. You now need to include the following css file:
While the groupbox
tag continues to work, the caption
tag has been removed. Use the following now:
Removed. Currently there is no working replacement part of Thunderbird itself, but Lightning has its own datetimepicker
, which can be used.
Its value is a JavaScript Date
object:
To be able to use the datetimepicker
, the following CSS files need to be included:
The following JavaScript files also need to be included:
If you do not want to be dependent on Lightning being installed, you need to include the above files with your add-on.
Removed. Thunderbird now has fixed build in notification boxes, where notifications can be added. The following list shows how to access some of them:
Main window:
let notifyBox = specialTabs.msgNotificationBar;
Message composer window:
let notifyBox = gNotification.notificationbox;
Below the recipient list in the message composer window: let notifyBox = gMessageNotificationBar.msgNotificationBar;
Most calendar dialogs:
let notifyBox = gNotification.notificationbox;
Since you no longer "own" notification boxes, you should not clear them by calling
notifyBox.removeAllNotifications();
as that would remove notifications added by others. You can get a specific notification by calling
let notification = notifyBox.getNotificationWithValue(value);
and remove only that via
notificationbox.removeNotification(notification);
Removed. Use:
The element mail-multi-emailHeaderField
has been renamed into mail-multi-emailheaderfield
(no camelCase anymore).
Each treecol
can be either shown or hidden via the column picker. Up to TB68 the column picker closed after a column had been selected/toggled. By adding closemenu="none"
to a treecol
, the column picker stays open after the display state of associated treecol
has been toggled.
Previously, if you had a <dialog>
and you wanted to respond to the buttons being pressed, you’d have something like this:
The event handler would return true if the dialog should close, or false to prevent closing. This no longer works. Instead, add the event handlers in JavaScript:
To prevent closing of the dialog, call preventDefault()
. A return value is not needed.
This is valid for ondialogaccept
, ondialogextra1
, ondialogextra2
and ondialogcancel
.
The section about <dialog>
events also applies to all onwizard…
events on <wizard>
, and onpage…
events on <wizardpage>
.
As JavaScript itself evolves, browser engines will change accordingly. The following changes represent changes that affect JavaScript extension developers.
The nonstandard generic string methods have been deprecated and removed in the Geko engine and therefore Thunderbird 68+. A deprecation exception is issued if any methods are used. The updated paradigm uses String instance methods allowing for the use on any object.
Deprecated Generics Syntax:
Instance Method Replacement:
The following String methods are affected by the change:
(All other String methods use the instance paradigm already)
A number of JavaScript modules have been renamed with the .jsm
extension. Most notably:
MailUtils.js
is now MailUtils.jsm
.
MailUtils.getFolderForUri
was renamed to MailUtils.getExistingFolder
.
In Thunderbird 67, a major backwards-incompatible change was made to importing JavaScript modules. Where once you used any of these:
Or the two-argument variation:
You should now do this:
ChromeUtils.import
is a replacement for Components.utils.import
(which was also changed in this way). Note that no second argument is supplied. The returned object is a dictionary of only the objects listed in EXPORTED_SYMBOLS
.
The function to retrieve passwords has lost its first parameter. Instead of
call it as
Removed, use:
you need to call it as
The defaultAccount
member can (since TB 65) have a null
value - if for some reason it doesn't have, or can't work out, the default account.
Hence you need to null-check it, and possibly handle not having an account at all (if in no other way than by an error message).
Removed. Use
To be backward compatible you need to probe the parameters. In case the third parameter is an nsIInputStream it is the old API. If the second one is an input stream it is the new API.
The onStartRequest
and onStopRequest
methods also no longer have a context
argument, which could be detected in a similar way.
As newChannel
has been unused for a long time it should be safe to just replace the old newChannel
implementation with the newChannel2
and forward calls from newChannel2
.
The method convertFromByteArray
has been removed. The new preferred way to deal with unicode is through the TextEncoder
and TextDecoder
classes.
To convert byte arrays to different charsets, use
Removed. Use Element
, Node
, etc. instead, which are now available in all scopes.
These no longer need to be created by Cc[...].createInstance(Ci....)
, but simply via the new
keyword:
new DOMParser();
new XMLSerializer();
new XMLHttpRequest();
They should be available in all scopes now. If not, the following is needed:
Cu.importGlobalProperties(["DOMParser"]);
Cu.importGlobalProperties(["XMLSerializer"]);
Cu.importGlobalProperties(["XMLHttpRequest"]);
Trees have changed a lot. The tree
object is now a XULTreeElement
. It has lost thetreeBoxObject
property, because the nsITreeBoxObject
has been removed. Most of its methods can now be accessed directly through the tree
object. For example:
Furthermore, nsITreeColumn
has been replaced by the TreeColumn
object. Even though their interfaces look the same, they could behave differently. Check your implementation, as this affects almost all methods of nsITreeView
.
Some noteworthy changes:
If a method requires a TreeColumn
parameter, a simple { id: columnName }
object no longer works. Get a proper TreeColumn
object via tree.columns.getNamedColumn(columnName)
.
Trees no longer support selecting individual cells. The TreeColumn
object no longer has a selectable
attribute and nsITreeView
has lost its isSelectable()
method.
Removed. Use
Renamed to
A long time ago newChannelFromURI2() has been added as an alternative to newChannelFromURI(), which as become deprecated by now. With ESR68 the old name is used again.
With , you can see all the bugs related to de-XBL-ing Thunderbird, and see how the removal of each binding is handled.
If you have your own XBL bindings, you can convert them to . Here are some notes on the process of .
As part of the de-XBL effort, the usage of the Interface has also been deprecated. This includes:
They have to be replaced by , or similar methods. The documents these methods have been used with have probably changed dramatically. Check out to learn about the current layouts.
The following list also includes deprecated elements, which could still be used but Thunderbird has already started to purge their usage. In that case you must update your overlay files which are overlaying such elements, otherwise your overlay will not be applied. Check for the current state of the files you are overlaying.
Note that the DOCTYPE
changed and the preference
attribute now contains the full ID of the preference. If you used more than one prefpane
you need to rework the UI into .
Furthermore, note the included JavaScript file at the bottom, which is mandatory to recreate the functionality of the preference
attribute. It is also mandatory, that you include a custom JavaScript file (aspreferences.js
in the above example) afterwards, which defines the types of the used preferences (which was formerly done inside the preferences
tag). The file can be as short as this:
If you are doing or plan to do any advanced stuff with the preferences in JavaScript, like validating user entered values and such, it is recommended to abandon the usage of the preference
attribute (and preferencesBindings.js
) and directly use the instead.
The XUL element menulist
no longer supports the editable
attribute. However, editable menulists have been re-implemented as . To be able to use it, you need some extra files to be linked from your document:
In the current Thunderbird 68 Beta, this still looks a bit wrong, but will be fixed in Beta 3. More details can be found in .
You can still add notification boxes wherever you want, if you do not want to use the build in notification boxes (or if there is none). More details can be found .
See e.g.
mailServices.js
has been renamed to MailServices.jsm
. This change was originally backwards-compatible with a deprecation warning, but the changes to module importing (see ) made that pointless and the old file has now been removed completely.
Note: document.persist()
used the ID attribute whereas xulStore.persist()
uses the actual DOM node. More details in bug .
All methods of the API now return a Promise instead of executing a callback. Instead of calling it as
The onDataAvailable
method lost its context
argument. This was removed in which breaks the API.
The obsolete method newChannel
was removed and newChannel2
was renamed to newChannel
. (.)
now returns a .
In general, check to see the current definitions of tree related implementations: