# Update for Thunderbird 128

This section covers the required update steps for add-ons which are already compatible with Thunderbird 115 and need to be made compatible with Thunderbird 128.

## Changes in Manifest V2 WebExtension APIs

Our WebExtension APIs are meant to be stable, but we did have to introduce a backward incompatible change:

* Introduction of the ***messagesUpdate*** permission, required to use [messages.update()](https://webextension-api.thunderbird.net/en/esr-mv2/messages.html#messages-update).

## Introducing Manifest V3

Thunderbird 128 is the first release to officially support [Manifest Version 3](https://developer.thunderbird.net/add-ons/whats-new/manifest-v3). A guide to convert extensions from Manifest V2 to Manifest V3 can be found in our WebExtension API documentation:

* [Convert extensions to Manifest V3](https://webextension-api.thunderbird.net/en/mv3/guides/manifestV3.html)

## Changes in Thunderbird Core

Thunderbird WebExtensions can still run legacy code inside [Experiments](https://developer.thunderbird.net/mailextensions#experiment-apis). Such legacy code has to be adjusted to changes made in Thunderbird Core. All known changes are listed below.

If you have encountered a change which is not yet listed there, please [contact us](https://developer.thunderbird.net/add-ons/community), so we can update the list.

### **ESMification**

The Thunderbird team has finished the conversion of all its JSM files and now only uses ES6 modules instead. There is a compatibility layer, which still maps requests for the old `*.jsm` files to the new `*.sys.mjs` files. It is however recommended to use the new files now already. The new files are either loaded via `ChromeUtils.importESModule()`:

```javascript
const { XPCOMUtils } = ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs");
```

or via `ChromeUtils.defineESModuleGetters()`:

```javascript
ChromeUtils.defineESModuleGetters(this, {
  AttachmentInfo: "resource:///modules/AttachmentInfo.sys.mjs",
  MailUtils: "resource:///modules/MailUtils.sys.mjs",
  PluralForm: "resource:///modules/PluralForm.sys.mjs",
});
```

### nsIMsgCopyServiceListener

Changed in Thunderbird 126 (Bug 1887047).

* `OnProgress()` -> `onProgress()`
* `OnStartCopy()` -> `onStartCopy()`
* `OnStopCopy()` -> `onStopCopy()`
* `GetMessageId()` -> `getMessageId()`
* `SetMessageKey()` -> `setMessageKey()`

### thread-pane-columns.mjs

This file has been renamed to `ThreadPaneColumns.mjs` in Thunderbird 128 (Bug 1890731).

### nsIFilePicker::init()

Changed in Thunderbird 125 (Bug 1878401). The type of the first parameter was changed from `DOMWindow` to `BrowsingContext`. It will fail when a `DOMWindow` is passed in. Every `DOMWindow` has a `browsingContext` getter:

`window.browsingContext`

### FileUtils.getFile()

The `getFile()` method has been removed in Thunderbird 116 (Bug 1747467). Use `FileUtils.File()` instead. Example:

```javascript
let file = FileUtils.getFile("TmpD", [fileName]);
```

can be replaced by

```javascript
let file = new FileUtils.File(PathUtils.join(PathUtils.tempDir, fileName));
```

### MailServices.accounts.FindAccountForServer()

The `FindAccountForServer()` method has been renamed to `findAccountForServer()` in Thunderbird 121 (Bug 1865068).

### MozElements.NotificationBox.appendNotification()

The implementation of this method has become `async` in Thunderbird 123. The [NotificationBox Experiment](https://github.com/thunderbird/webext-experiments/tree/main/NotificationBox) has been adjusted accordingly.

### Services.jsm

The file `Services.jsm` and its compatibility layer (added in Thunderbird 115) have been removed, and loading it will now cause an error in Thunderbird 128. It is safe to simply remove all code which was used to load the module in Thunderbird 115 and later.

### Services.logins.addLogin()

The `addLogin()` method has been replaced by the async method `Services.logins.addLoginAsync()`.

### XPCOMUtils.defineLazyGetter()

This method has been a thin wrapper for `ChromeUtils.defineLazyGetter()` since Thunderbird 112 (Bug 1805288). Its usage has been purged from core code and it may stop working anytime.
