Thunderbird/Add-ons Guide 63

From MozillaWiki
< Thunderbird
Revision as of 12:42, 8 December 2018 by Oeekker (talk | contribs) (Fix tpyo)
Jump to navigation Jump to search

Add-ons Guide for Thunderbird 63 and beyond

If you have programming questions or wish to discuss the future can be posted in the mozilla.dev.apps.thunderbird newsgroup, see Communication Channels.

The following extension types are supported in from Thunderbird 63 and beyond:

WebExtensions

This is the same type of addon that Firefox currently uses. For a general introduction, see WebExtensions and What are WebExtensions.

However, the APIs are necessarily different between Thunderbird and Firefox. Some applicable Firefox APIs work in Thunderbird (just try it), other Firefox APIs do not work, and Thunderbird has a few Thunderbird-specific APIs added. There is some documentation for the Thunderbird WebExtension APIs. For any API that is not yet provided, WebExtension Experiments can be used.

There are not many WebExtensions for Thunderbird yet, so you're in new territory. Don't expect a smooth ride. But being a pioneer can be exciting, too. Help wanted!

Details: WebExtensions have a manifest.json. As documented on Thunderbird WebExtension APIs, the following WebExtension APIs are available in Thunderbird:

Bootstrapped extensions

Bootstrapped/restartless extensions with an install.rdf manifest. The code to handle bootstrapped extension and install.rdf has been moved to comm-central in bug 1510097 and should be stable now. Important: Bootstrapped legacy extensions continue to work without a manifest.json file and will in fact break if you add that file.

"Legacy" XUL extensions with overlays

"Legacy" XUL extensions with overlays are still "somewhat" supported in Thunderbird 63 and beyond. An inbuilt overlay loader will load XUL overlays for extensions but may cause graphical glitches or malfunctions. We're tracking this in bug 1476259.

Warning: Scripts in overlays are now run after all elements have been inserted into the document. This may cause unexpected behavior if your script previously ran before elements were inserted. For elements with event handlers these event handlers may run when the element is added, and they may fail if they rely on content being set up by a script which now runs after the creation of the element.

To use this overlay loader, XUL overlay legacy extensions must replace install.rdf file with a WebExtensions style manifest.json file, which includes the key "legacy" set to true. See Lightning as an example:
https://hg.mozilla.org/comm-central/rev/e81f4b59a00a7d3e18d50fd3851ecbd47762a186#l2.5 (Note: In this changeset the @variables@ are build variables, add-ons need to use fixed strings).
If your add-on has options specified in install.rdf, you need to put this in the manifest.json also. To do this, add the file to the key "legacy" instead of the value true in the following way:

  "legacy" : {
    "options" : {
      "page" : "chrome://[path to your options.xul]",
      "open_in_tab" : true/false
    }
  }

The key open_in_tab with value true corresponds to optionsType 3 in install.rdf. Examples of extensions converted to this type include "Lightning", "Compact Header", "Signature Switch" and "ThunderHTMLedit" (as of 3rd December 2018).

Removed in Thunderbird 60

Overlays have been progressively removed starting from this version. By version 63, there are no overlays left in Thunderbird. Due to Thunderbird's own overlay loader, XUL add-ons can still use overlays, but they can of course not overlay the removed Thunderbird overlays any more. For example, if your add-on overlaid mailWindowOverlay.xul, that needs to be changed; in this example you most likely need to overlay messenger.xul now.

Removed in Thunderbird 61

  • XUL elements' .insertItemAt() and .removeItemAt() methods
    Replacement: Use .insertBefore() and .remove().
  • You can also use .setUnsafeInnerHTML() or document.allowUnsafeHTML = true, as a workaround to the above, see see here.

Removed in Thunderbird 63

  • XUL elements listbox, listboxitem and listcell.
    Replacement: richlistbox.
  • XUL stringbundleset / stringbundle. You will also be unable to use the `nsIStringBundleService` interface.
 Replacement: Use Services.strings.createBundle(...)

Removed in Thunderbird 64

  • XUL element colorpicker.
    Replacement: HTML input type=color

Removed in Thunderbird 65

  • XUL element progressmeter.
    Replacement: HTML progress