Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Thunderbird 5 for developers

Draft
This page is not complete.


This content covers features introduced in Thunderbird 5

This page lists the changes in Thunderbird 5 that are relevant for developers. For changes that are relevant to end users, see https://support.mozillamessaging.com/kb/new-thunderbird-5/.

Gecko 5.0

Thunderbird 5 is based on Gecko 5.0. The Firefox 4 and Firefox 5 pages have details on the significant changes to Gecko.

Changes for Mozilla and add-on developers

For helpful tips on updating existing extensions for Thunderbird 5, see Updating extensions for Firefox 4. There are several key changes that break compatibility with existing add-ons, so be sure to read that article.

STEEL

  • Thunderbird 5 will include the new add-ons manager. As a side effect, the global Application object won't have an extensions property anymore. See this blog post for more details.

JavaScript code modules

Services.jsm
The Services.jsm code module provides getters that make it easy to obtain references to commonly-used services, such as the preferences service or the window mediator, among others.
mailServices.js
The mailServices.js code is similar to Services.jsm but is for mail specific functions.
JS-ctypes API
The JS-ctypes API makes it possible to call C-compatible foreign library functions without using XPCOM.
Add-ons Manager
The new Add-ons Manager provides information about installed add-ons, support for managing them, and provides ways to install and remove add-ons.
Loading code modules from chrome: URLs
You can now load JavaScript code modules using chrome: URLs, even inside JAR files.
DownloadLastDir.jsm
The DownloadLastDir.jsm code module provides the gDownloadLastDir global variable, which contains a string you can use to learn the path of the directory into which the last download occurred. This module handles issues related to private browsing for you.

Miscellaneous changes to code modules

The NetUtil.jsm code module now offers the readInputStreamToString() method, which lets you read arbitrary bytes from a stream into a string, even if the stream includes zeroes.

MimeMessage API

The MsgHdrToMimeMessage function from Cu.import("resource:///modules/gloda/mimemsg.js"); now returns a MimeMessage with enhanced properties. This is the recommended way to easily parse a message into a hierarchical MIME tree, and examine it. Should you find that API to be too restrictive, please do let us know!

  1. MimeMessageAttachment instances now sport a size property which allows you to conveniently access the size of a message's attachment.

  2. MimeMessage instances now feature a brand new allUserAttachments property which accurately represents the attachments that will be displayed in the message reader. This is probably what you have in mind when you think "attachments". The allAttachments property doesn't include MIME parts such as attached emails.

  3. To speed things up, if the message is stored only on the remote IMAP server, you can add an extra partsOnDemand: true member to the options object that you pass to MsgHdrToMimeMessage, and the backend won't download attachments such as images.

Gloda API

Gloda-indexed messages now feature an additional property called attachmentInfos, which allows you to quickly manipulate a given message's attachments without having to re-stream it through MsgHdrToMimeMessage. attachmentInfos is a list of objects whose properties are url, size, contentType, name. Please note as of 5a1, there are no plans to bump the database schema, which means only messages indexed after 5 was installed will have this property. You can force gloda to reindex messages that have an attachmentTypes property, though. GlodaMsgIndexer from Cu.import("resource:///modules/gloda/index_msg.js") is probably what you need for this.

Backend changes

  • When streaming a message through DisplayMessage, you can now add an extra &markRead=false parameter to the URI to prevent the backend from marking a message as read when you display it (on IMAP).
  • Thunderbird's tabmail now honors onbeforeunload event handlers. If you're developing something inside a content or a chrome tab, now here's your chance to prevent the tab from being closed.
  • Chrome tabs now can have favicons as well.
  • When opening a content tab, an extra onload arguments allows you to be notified when the tab is done loading.
  • A new "fake header" mechanism has been introduced. Fake headers are inserted after a message has been sent, and serve as placeholder, while autosync fetches the actual header from the remote IMAP server. Their message keys are in the range 2**32 - 128 to 2**32 - 1. They disappear after the real header has come in. This might be surprising for some addons which manipulate message headers, as the message header might become invalid.

XPCOM

In addition to the specific changes referenced below, it's important to note that there are no longer any frozen interfaces. All interfaces are now unfrozen, regardless of what the documentation may say. We'll update the documentation over time.

XPCOM changes in Gecko 2.0
Details about changes to XPCOM that impact compatibility in Firefox 4.
Components.utils.getGlobalForObject()
This new method returns the global object with which an object is associated; this replaces a common use case of the now-removed __parent__.

Other Changes

  • Thunderbird has been changed from building statically, to building libxul style.
  • Thunderbird now supports the out-of-process plugins facilities that Firefox supports.
  • Most of the resources contained within Thunderbird have been combined into a single JAR archive, omni.jar, which improves startup performance by reducing I/O. For details, read About omni.jar.
  • Content tabs now support favicons in the same way that Firefox does.
  • Thunderbird releases are now numbered according to the corresponding Gecko release. See the discussion on the tb-planning list for more information.

More resources

The code name for Thunderbird 5 is 'Miramar'.

Document Tags and Contributors

Tags: 
 Contributors to this page: chrisdavidmills, trevorh, Standard8, squib, Marsf, mozjonathan, jenzed, Kohei
 Last updated by: chrisdavidmills,