12
edits
(Added description about options for TB65+) |
John.bieling (talk | contribs) (Update link to add-on update guide) |
||
(23 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
<big>'''Add-ons Guide for Thunderbird 63 and beyond'''</big> | <big>'''Add-ons Guide for Thunderbird 63 and beyond'''</big> | ||
{{note|This guide has been deprecated. All its information has been moved to [https://developer.thunderbird.net/add-ons/updating developer.thunderbird.net]. Please do not add new information to this wiki, but get in contact with us and share what is missing and it will be added to the official guide. The goal is to have one single source of information.}} | |||
'''Contact:''' Check the mozilla.dev.apps.thunderbird newsgroup and our [[Thunderbird/CommunicationChannels#If_you.27re_a_developer|communication channels]]. | |||
__TOC__ | __TOC__ | ||
=== Supported extension types === | |||
The following extension types are supported in from Thunderbird 63 and beyond: | The following extension types are supported in from Thunderbird 63 and beyond: | ||
=== WebExtensions === | ==== WebExtensions ==== | ||
This is the same type of addon that Firefox currently uses. For a general introduction, see [https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions WebExtensions] and [https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/What_are_WebExtensions What are WebExtensions]. | This is the same type of addon that Firefox currently uses. For a general introduction, see [https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions WebExtensions] and [https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/What_are_WebExtensions What are WebExtensions]. | ||
Line 25: | Line 29: | ||
* And more, check meta-{{bug|1396172}} | * And more, check meta-{{bug|1396172}} | ||
=== Bootstrapped extensions === | ==== 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. | 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 ==== | ||
"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}}. | "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}}. | ||
Line 36: | Line 40: | ||
<source lang="json"> | <source lang="json"> | ||
{ | |||
… | |||
"legacy" : { | "legacy" : { | ||
"options" : { | "options" : { | ||
Line 42: | Line 48: | ||
} | } | ||
} | } | ||
} | |||
</source> | |||
The key <code>open_in_tab</code> is optional and defaults to value false. Value true corresponds to <code>optionsType 3</code> in <code>install.rdf</code>. | |||
Examples of extensions converted to this type (as of 3rd December 2018): | |||
* [https://addons.thunderbird.net/de/thunderbird/addon/mailredirect/ Mail Redirect] (version on ATN includes a good example of a working manifest.json) | |||
* "Lightning" | |||
* "Compact Header" | |||
* "Signature Switch" | |||
* "ThunderHTMLedit" | |||
* [https://github.com/jikamens/send-later/ Send Later] | |||
== 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 <code>mailWindowOverlay.xul</code>, that needs to be changed; in this example you most likely need to overlay <code>messenger.xul</code> now. | |||
== Removed in Thunderbird 61 == | |||
* XUL element method <code>.insertItemAt()</code>, replacement: <code>.insertBefore()</code> | |||
* XUL element method <code>.removeItemAt()</code>, replacement: <code>.remove()</code>, example: <code>listElement.removeItemAt(i)</code> -> <code>listElement.getItemAtIndex(i).remove()</code> | |||
* You can also use <code>.setUnsafeInnerHTML()</code> or <code>document.allowUnsafeHTML = true</code>, as a workaround to the above, see [[Thunderbird/Add-ons_Guide_57#Removed_and_changed_in_mozilla60|here]]. | |||
* The interface of <code>AddonManager.getAddonByID</code> has changed. It now returns a promise, so instead of calling it as <code>AddonManager.getAddonByID(''addon_id'', ''callback_function'')</code>, you need to call it as <code>AddonManager.getAddonByID(''addon_id'').then(''callback_function')</code>. | |||
== Removed in Thunderbird 63 == | |||
* XUL elements <code>listbox</code>, <code>listboxitem</code> and <code>listcell</code>. <br/>Replacement: <code>richlistbox</code> ([https://github.com/jobisoft/CategoryManager/commit/2267888be7de0d7ebe4f5b4626c48210c071b16f example migration]) | |||
* XUL <code>stringbundleset</code> / <code>stringbundle</code>. You will also be unable to use the `nsIStringBundleService` interface.<br/>Replacement: Use <code>Services.strings.createBundle(...)</code>. | |||
* <code>mailServices.js</code> has been renamed to <code>MailServices.jsm</code>. The old name keeps working for now, but you get a deprecation warning in the error console if you use the old name. | |||
* Starting in Thunderbird 63, all XBL-bindings will be removed from Thunderbird. That means, that if you have a XBL=binding in your add-on that extends a binding that is removed, your binding will fail. With [https://bugzilla.mozilla.org/buglist.cgi?o1=equals&v1=1484976&f1=blocked this] query, you can see all the bugs related to de-xbl-ing Thunderbird, and see how the removal of each binding is handled. | |||
* A bunch of globals in the message composition window were removed: <code>nsIMsgCompDeliverMode</code>, <code>nsIMsgCompSendFormat</code>, <code>nsIMsgCompConvertible</code>, <code>nsIMsgCompType</code>, <code>nsIMsgCompFormat</code>, <code>nsIAbPreferMailFormat</code>, <code>nsIPlaintextEditorMail</code>, <code>nsISupportsString</code>, and <code>mozISpellCheckingEngine</code>. If you use any of these, there are available as the same names underneath <code>Ci.</code> (a.k.a. <code>Components.interfaces.</code>). | |||
== Removed in Thunderbird 64 == | |||
* XUL element <code>colorpicker</code>.<br/>Replacement: HTML <code>input type=color</code> | |||
== Removed in Thunderbird 65 == | |||
* XUL element <code>progressmeter</code>.<br/>Replacement: HTML <code>progress</code> ([https://github.com/jobisoft/CategoryManager/commit/be23d9abfba29e5585d485348d84bd36c3c6bcaf example migration]) | |||
* There is no longer a <code>statusbar</code> element. Instead of putting <code>statusbar</code> elements inside a <code>statusbarpanel</code> in your XUL, they need to go inside an <code>hbox</code>. The <code>hbox</code> contains have the same names as the old <code>statusbar</code> containers, so you just need to change the element type. Also, if your status bar items had popup menus attached to them, you will need to do that differently now as well. See [https://github.com/jikamens/send-later/blob/664468e4c29ba435edfeba8524d19a37a47dfda5/chrome/content/backgrounding.xul#L9 this example]. | |||
== Changes in Thunderbird 67 == | |||
* The <code>nsIRequestObserver.onStopRequest</code> and <code>nsIStreamListener.onDataAvailable</code> interfaces have changed. The <code>aContext</code> argument has been removed. Especially stream listeners need to be updated so that they no longer expect this argument. | |||
* <code>MailUtils.getFolderForUri</code> was renamed to <code>MailUtils.getExistingFolder</code>. | |||
==== Importing javascript modules ==== | |||
A major backwards-incompatible change was made to importing javascript modules. Where once you used any of these: | |||
<source lang="javascript"> | |||
Components.utils.import("resource://foo/modules/Foo.jsm"); | |||
// or… | |||
Cu.import("resource://foo/modules/Foo.jsm"); | |||
// or… | |||
ChromeUtils.defineModuleGetter(this, "Foo", "resource://foo/modules/Foo.jsm"); | |||
// or the two-argument variation: | |||
var { Foo } = Cu.import("resource://foo/modules/Foo.jsm", null); | |||
// or… | |||
var scope = {}; Cu.import("resource://foo/modules/Foo.jsm", scope); // scope.Foo… | |||
</source> | |||
You should now do this: | |||
<source lang="javascript"> | |||
var { Foo } = ChromeUtils.import("resource://foo/modules/Foo.jsm"); | |||
// or… | |||
var scope = ChromeUtils.import("resource://foo/modules/Foo.jsm"); // scope.Foo… | |||
</source> | </source> | ||
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. | |||
==== Editable menulists ==== | |||
The standard XUL element <code>menulist</code> no longer supports the <code>editable</code> attribute. However, editable menulists have been re-implemented using a custom element. To be able to use it, one has to include <code>menulist.css</code> and <code>customElements.js</code>: | |||
<source lang="xml"> | |||
<?xml version="1.0"?> | |||
<?xml-stylesheet href="chrome://messenger/content/menulist.css" type="text/css"?> | |||
... | |||
<script type="application/javascript" src="chrome://messenger/content/customElements.js"/> | |||
... | |||
== | <menulist is="menulist-editable" editable="true"> | ||
<menupopup> | |||
= | <menuitem label="Label1" /> | ||
</menupopup> | |||
</menulist> | |||
... | |||
</source> | |||
To be able to use this custom element from JS, the following is needed (in addition to the includes mentioned above): | |||
<source lang="javascript"> | |||
let menulist = document.createElement("menulist", { is : "menulist-editable"}); | |||
menulist.setAttribute("is", "menulist-editable"); | |||
menulist.setAttribute("editable", "true"); | |||
</source> | |||
== | == See also == | ||
More information about updating extensions for Thunderbird 68 can be found [https://developer.thunderbird.net/add-ons/tb68 here]. | |||
edits