Adapt to Changes in Thunderbird 69-78

This document tries to cover all the internal changes that may be needed to make add-ons compatible with Thunderbird 78. If you find changes which are not yet listed on this page, you can ask for help and advice in one of our communication channels.

The changes are grouped by category and are listed in the order we became aware of them.

Changed XUL elements

<textbox>

Removed completely in TB71. Use

<html:input>

All former values of the type parameter of the textbox element are supported by html:input as well. For proper styling include the following CSS file: chrome://messenger/skin/input-fields.css

The flex parameter is no longer supported and should be removed. Attach the input-container class to a surrounding hbox to force the input field to behave like a former flex="1" textbox.

If the input fields context menu is not working, you need to include two JavaScript files by adding:

JavaScript methods that are using element.localName == "textbox" , getElementsByTagName("textbox")or similar need to be updated as well.

Visually compare the fields before and after the conversion to be sure the UI, sizing, and spacing doesn't change.

<toolbar customizable="true">

In TB78, the XUL element toolbar with attribute customizable has been re-implemented as a custom element. It needs an additional is attribute. The following example is taken from the source of the Thunderbird calendar:

<wizard>

In TB78, the XUL element wizard may no longer be a top level element, but must be encapsulated by a window element which includes some fluent locales:

If you have referred to the wizard element by document.documentElement.*, this is now referring to the window element. Use getElementById() instead.

<wizardpage>

If you set the label of a wizardpage element via JavaScript during wizard load, it will be ignored. You have to manually call _adjustWizardHeader after the label has been set. :

<richlistbox>

With TB78, the method scrollToIndex(idx) has been removed, replace it with:

Changed API

document.createElement()

With TB69, the default namespace for createElement has switched from XUL to HTML. So you can no longer create XUL elements with document.createElement() (but HTML elements). To create XUL elements, use:

nsISocketTransportService

Bug 1558726 introduced a breaking change to the nsISocketTransportService interface:

The first parameter used to be an array and the second one its length. This length parameter has been dropped, causing all subsequent arguments to shift by one. Furthermore, to create a default socket, you now have to pass an empty array as the first parameter, instead of null.

To stay backward compatible, check the argument count of "createTransport". In case it is 4 it is the new interface, in case it is 5 you got the old interface. Alternatively, you may also check if the version of Thunderbird is 69 or later.

nsICookie2

Merged into nsICookie.

window.QueryInterface()

With TB70, window objects don't need to be and cannot be QI'ed to nsIDOMChromeWindow, nsIDOMWindow and nsIInterfaceRequestor. You can just remove its usage, this is backwards compatible to TB 68.

This does not apply to nsIXULWindow, which for example is used in nsIWindowMediatorListener.onOpenWindow(xulWindow).

Equally, TreeColumns and TreeContentView don't need to be and cannot be QI'ed to nsITreeView.

Services.scriptSecurityManager.createCodebasePrincipal()

Renamed. Use

nsIStringBundle.formatStringFromName()

The 3rd parameter has been dropped, which was the length of the array passed in as the 2nd parameter. See the patch applied to Thunderbird itself.

IOUtils.js

Module file extension changed in TB78 from js to jsm, now available via

AddRecipient()

In TB78 the function AddRecipient() in the contact sidebar has been renamed to awAddRecipientsArray().

MailServices.headerParser.parseHeadersWithArray()

In TB71 MailServices.headerParser.parseHeadersWithArray() has been removed. Instead, use:

nsIPromptService.select()

Since TB69 nsIPromptService.select() / Services.prompt.select() has dropped the parameter which specifies the length of the array of the item list which the user can choose from. See the patch applied to Thunderbird itself.

nsIEditorStyleSheets has been removed

The removal of nsIEditorStyleSheets in TB77 necessitates the following changes:

  • nsIEditorStyleSheets.addOverrideStyleSheet(uri) -> windowUtils.loadSheetUsingURIString(uri, windowUtils.AGENT_SHEET)\

  • nsIEditorStyleSheets.removeOverrideStyleSheet(uri) -> windowUtils.removeSheet(uri, windowUtils.AGENT_SHEET)\

  • nsIEditorStyleSheets.enableStyleSheet(uri, enable) Either manually load or remove the stylesheet: -> windowUtils.loadStyleSheetUsingURIString(uri, windowUtils.AGENT_SHEET) -> windowUtils.removeSheet(uri, windowUtils.AGENT_SHEET)

getAnonymousElementByAttribute() and getAnonymousNodes() have been removed

These two methods are leftovers from de-XBL effort and have not been working since TB68. In TB72 they have been removed completely and using them will now throw an error. They have to be replaced by document.getElementById(), document.querySelectorAll() or similar methods.

The documents these methods have been used with have probably changed dramatically. Check out searchfox.org to learn about the current layouts.

Changes to the Address Book

Searching a nsIAbDirectory

In TB68 a nsIAbDirectory could be searched by simply attaching a search query to the URI of the directory when calling getDirectory():

In TB78 getDirectory() no longer accepts search queries and throws an error. Instead, use the search() method, which uses an nsIAbDirSearchListener. A simple promisified implementation could look like so:

Changes to the Preference System

Removal of onsyncfrompreference and onsynctopreference Attributes

With TB70, these two attributes have been removed from XUL elements like textbox, radio, checkbox and friends. This is no longer supported:

Most of the XUL based preferences system has been long removed and had to be replaced by either using the preferencesBindings.js wrapper or by manually reimplementing that functionality using thensIPrefService.

The second approach is not affected by this change, as it has full control over the load and save process for all its preferences. The preferencesBindings.js wrapper has been updated and now supports:

Last updated

Was this helpful?