### Thunderbird Development - Getting Started
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
Provides initial steps and guidance for developers looking to contribute to the Thunderbird project.
```markdown
* [Getting Started Contributing](thunderbird-development/getting-started.md)
```
--------------------------------
### Getting Started with Thunderbird Add-ons
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/about-add-ons.md
Provides a link to a tutorial for creating a first Thunderbird extension, guiding users through the initial steps.
```APIDOC
Getting Started:
There's a lot of information out there when it comes to add-on development, and finding the most relevant one can be time-consuming. We have therefore put together a tutorial that explains step by step how to create your first extension for Thunderbird:
hello-world-add-on/
```
--------------------------------
### Thunderbird Tutorials and Examples
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
Resources for learning Thunderbird development through tutorials and practical examples, including a 'Hello World' example.
```markdown
* [Tutorials and Examples](thunderbird-development/tutorials-and-examples/README.md)
* [Hello World Example](thunderbird-development/tutorials-and-examples/hello-world.md)
* [Thunderbird Live Development Videos](thunderbird-development/tutorials-and-examples/thunderbird-live-development-videos.md)
```
--------------------------------
### Thunderbird WebExtension Examples
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
A collection of example add-ons demonstrating various features and API usage within the Thunderbird environment. These examples serve as practical guides for developers.
```APIDOC
Thunderbird WebExtension Examples:
This repository contains various examples of Thunderbird add-ons built using the WebExtensions API.
Purpose:
- To showcase practical implementation of Thunderbird's WebExtension APIs.
- To provide starting points and reference code for developers.
- To demonstrate best practices in add-on development.
Content:
- Examples cover a range of functionalities, from simple UI modifications to complex mail manipulation.
- Each example typically includes the necessary manifest.json, background scripts, content scripts, and UI components.
Access Examples:
- Explore the examples at: https://github.com/thunderbird/webext-examples
```
--------------------------------
### Experiment APIs Manifest Configuration
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/mailextensions/README.md
An example of how to define an Experiment API in the manifest.json file, including the schema and implementation script paths, and parent scope configurations.
```json
{
"experiment_apis": {
"LegacyPrefs": {
"schema": "api/LegacyPrefs/schema.json",
"parent": {
"scopes": ["addon_parent"],
"paths": [["LegacyPrefs"]],
"script": "api/LegacyPrefs/implementation.js",
"events": ["startup"]
}
}
}
}
```
--------------------------------
### Thunderbird Modernized Update Guides
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/whats-new/README.md
Revised guides for converting legacy Thunderbird extensions to WebExtensions. These guides are more compact and feature clearer examples, reflecting recent experience.
```html
With the experience of the last few years, we have revised our guides for converting legacy extensions to WebExtensions. The information is now more compact and the examples have also been made clearer.
```
--------------------------------
### Sample Release Timeline for Thunderbird 136
Source: https://github.com/thunderbird/developer-docs/blob/master/releases/cadence.md
Provides a concrete example of the release timeline for Thunderbird version 136, illustrating the sequence of milestones from the start of the Daily build to the final release and subsequent point releases.
```APIDOC
Sample Release Timeline (Thunderbird 136):
Milestones:
- 136.0a1 starts: Jan 6
- 136.0a1 soft code freeze: Jan 27–Feb 3
- 136.0a1 pre-merge review: Jan 30
- Merge 136.0a1 central → beta: Feb 3
- 136.0b1: Feb 5
- 136.0b2: Feb 12
- 136.0b3: Feb 19
- 136.0b4: Feb 24
- 136.0b4 pre-merge review: Feb 24
- Merge 136.0b4 beta → release: Feb 25
- 136.0: Mar 4
- 136.0.1: Mar 18
```
--------------------------------
### Example manifest.json for a Thunderbird Theme
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/web-extension-themes.md
This snippet shows a complete manifest.json file for a Thunderbird theme, demonstrating the structure and various properties that can be defined for colors and images.
```javascript
{
"manifest_version": 2,
"name": "Nuvola WebExtension theme",
"version": "1.1",
"browser_specific_settings": {
"gecko": {
"id": "nuvola@paenglab.ch",
"strict_min_version": "60.0"
}
},
"description": "Light theme with some gradients.",
"icons": {
"16": "icon.png"
},
"theme": {
"colors": {
"frame": "#e7e8ec",
"tab_text": "#000",
"tab_line": "#1f9afd",
"tab_loading": "#1f9afd",
"tab_background_text": "#000",
"bookmark_text": "#333",
"toolbar_field": "#f2f2f2",
"toolbar_field_text": "#444",
"toolbar_field_highlight": "#1f9afd",
"toolbar_field_highlight_text": "#fff",
"toolbar_field_border": "#999",
"toolbar_field_focus": "#f2f2f2",
"toolbar_field_text_focus": "#000",
"toolbar_field_border_focus": "#1f9afd",
"toolbar_top_separator": "#aaa",
"toolbar_bottom_separator": "#888",
"toolbar_vertical_separator": "#888",
"sidebar": "#fbfbfb",
"sidebar_text": "#000",
"sidebar_highlight": "rgba(11,113,220,.6)",
"sidebar_highlight_text": "#fff",
"sidebar_border": "#999",
"popup": "#e6e8ef",
"popup_text": "#000",
"popup_border": "#666",
"popup_highlight": "#1f9afd",
"popup_highlight_text": "#fff"
},
"images": {
"theme_frame": "background.png"
}
}
}
```
--------------------------------
### panelUI.inc.xhtml Context Example
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/tutorials-and-examples/hello-world.md
Illustrates the placement of the new 'Hello World!' toolbar button within the `panelUI.inc.xhtml` file, following the existing `appmenu_help` button. This shows the integration into the application's UI structure.
```markup
```
--------------------------------
### Install Rust and Cargo
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Installs Rust and Cargo using the official installation script. This command downloads and executes the rustup installer.
```bash
curl https://sh.rustup.rs -sSf | sh
```
--------------------------------
### Example Default Preference File (Legacy)
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/historical-overview/legacy-to-modern.md
An example of a default preference file in the legacy `/defaults/preferences/` folder, defining preference names and their initial values.
```javascript
pref("extensions.myaddon.enableDebug", false);
pref("extensions.myaddon.retries", 5);
pref("extensions.myaddon.greeting", "Hello");
```
--------------------------------
### PanelUI.inc.xhtml Context Example
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/hello-world.md
Illustrates the insertion of the new 'Hello World!' toolbar button into the `panelUI.inc.xhtml` file, positioned after the existing 'appmenu_help' button. This shows the integration of the menu item into the UI structure.
```markup
```
--------------------------------
### Start Thunderbird Build
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/README.md
Command to initiate the Thunderbird build process from the source directory using the 'mach' build tool.
```bash
./mach build
```
--------------------------------
### mailCore.js Context Example
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/tutorials-and-examples/hello-world.md
Shows the `helloWorld` function integrated within the `mailCore.js` file, placed after the `openAboutSupport` function. This provides context for where the JavaScript code should reside.
```javascript
function openAboutSupport() {
let tabmail = document.getElementById("tabmail");
tabmail.openTab("contentTab", {contentPage: "about:support",
clickHandler: "specialTabs.aboutClickHandler(event);" });
}
function helloWorld(){
alert('Hello, World!');
}
```
--------------------------------
### Thunderbird Build Environment Setup
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
Details the prerequisites and steps for setting up a local build environment for Thunderbird development.
```markdown
* [Setting Up A Build Environment](thunderbird-development/setting-up-a-build-environment.md)
```
--------------------------------
### MailCore.js Context Example
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/hello-world.md
Shows the placement of the `helloWorld` function within the `mailCore.js` file, alongside the existing `openAboutSupport` function. This provides context for where the new JavaScript code should be inserted.
```javascript
function openAboutSupport() {
let tabmail = document.getElementById("tabmail");
tabmail.openTab("contentTab", {contentPage: "about:support",
clickHandler: "specialTabs.aboutClickHandler(event);" });
}
function helloWorld(){
alert('Hello, World!');
}
```
--------------------------------
### Building Thunderbird
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
Guides on the process of building Thunderbird, including platform-specific prerequisites and artifact generation.
```markdown
* [Building Thunderbird](thunderbird-development/building-thunderbird/README.md)
* [Windows Build Prerequisites](thunderbird-development/building-thunderbird/windows-build-prerequisites.md)
* [Linux Build Prerequisites](thunderbird-development/building-thunderbird/linux-build-prerequisites.md)
* [macOS Build Prerequisites](thunderbird-development/building-thunderbird/macos-build-prerequisites.md)
* [Artifact Builds](thunderbird-development/building-thunderbird/artifact-builds.md)
```
--------------------------------
### Example Extension File Structure
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/hello-world-add-on/README.md
This snippet shows the typical directory structure for a Thunderbird extension, including the manifest file, images, and popup-related files.
```tree
hello-world/
├── manifest.json
├── images/
├── internet.png
├── internet-16px.png
└── internet-32px.png
└── mainPopup/
├── popup.css
├── popup.html
└── popup.js
```
--------------------------------
### Install Rust and C Bindings via Homebrew
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Instructions for installing Rust and the cbindgen tool using Homebrew, a package manager for macOS and Linux.
```shell
brew install rust
```
```shell
cargo install cbindgen
```
--------------------------------
### Install cbindgen
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Installs cbindgen, a tool used to generate C bindings from Rust code, using Cargo.
```bash
cargo install cbindgen
```
--------------------------------
### Info.plist Example
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/codebase-overview/chat/message-styles.md
An example of an Info.plist file used in Thunderbird message styles, demonstrating the usage of keys like ActionMessageTemplate, DefaultVariant, and MessageViewVersion.
```markup
ActionMessageTemplate<span class="pseudo" style="%senderColor%">%sender%</span> %message%DefaultVariantNormalMessageViewVersion4
```
--------------------------------
### Installing Rust via HomeBrew
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Installs the Rust programming language using the HomeBrew package manager, a recommended method for systems where HomeBrew is available.
```Shell
brew install rust
```
--------------------------------
### Options Page Configuration
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/mailextensions/README.md
Configures the options page for an extension, specifying the HTML file and whether it should open in a new tab or use browser styles.
```json
{
"options_ui": {
"page": "options/options.html",
"open_in_tab": false,
"browser_style": true
}
}
```
--------------------------------
### Wrapped WebExtension Background Script Example
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/historical-overview/README.md
Demonstrates the use of the messenger.WindowListener API for registering preferences, URLs, options pages, and windows in a Wrapped WebExtension.
```javascript
await messenger.WindowListener.registerDefaultPrefs(
"defaults/preferences/prefs.js"
);
await messenger.WindowListener.registerChromeUrl([
["content", "myaddon", "chrome/content/"],
["resource", "myaddon", "chrome/"],
["locale", "myaddon", "en-US", "chrome/locale/en-US/"],
["locale", "myaddon", "de-DE", "chrome/locale/de-DE/"],
]);
await messenger.WindowListener.registerOptionsPage(
"chrome://myaddon/content/options.xhtml"
);
await messenger.WindowListener.registerWindow(
"chrome://messenger/content/messengercompose/messengercompose.xhtml",
"chrome://myaddon/content/messengercompose.js"
);
await messenger.WindowListener.startListening();
```
--------------------------------
### Thunderbird Build Environment Setup
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/setting-up-a-build-environment.md
This section outlines the general steps and information required to set up a development environment for Thunderbird. It covers version control, source code structure, and links to platform-specific prerequisites.
```markdown
# Setting Up A Build Environment
## Build Prerequisites
Before you can build Thunderbird, please follow your platform's build prerequisites page:
* [Windows Build Prerequisites](building-thunderbird/windows-build-prerequisites.md)
* [Linux Build Prerequisites](building-thunderbird/linux-build-prerequisites.md)
* [macOS Build Prerequisites](building-thunderbird/macos-build-prerequisites.md)
## General Information
### Mercurial Version Control
Mozilla uses the [Mercurial version control](https://www.mercurial-scm.org/) software to propose, review, incorporate, and log changes to its code. In order to contribute to Thunderbird, you will need to be able to use this software.
Information for how to install Mercurial is available [via the download page on their wiki](https://www.mercurial-scm.org/wiki/Download).
### Mozilla Code Base
#### mozilla-central vs. comm-central
The latest Mozilla source code comes from Mozilla's `mozilla-central` Mercurial code repository, often called `source/` but it can be named anything you like. The latest Thunderbird source code comes from Mozilla's `comm-central` Mercurial code repository and needs to be placed **inside** the Mozilla source code, in a directory that must be named `comm/`.
Mozilla-central will build Firefox without the comm-central repo present and a few options set (detailed on the [Building Thunderbird](building-thunderbird/) page).
### Additional Documentation
Thunderbird is built on the Mozilla platform, the same base that Firefox is built from. As such the two projects share a lot of code and much of the documentation for one will apply, in many ways, to the other. If at any point you are looking for answers that you can't find here, here are some additional useful resources:
* [Thunderbird Source Tree Documentation](https://source-docs.thunderbird.net)
* [Firefox Source Tree Documentation](https://firefox-source-docs.mozilla.org/)
* [Mozilla's Developer site called: **MDN**](https://developer.mozilla.org)
## What's Next
If you have already gone through the relevant build prerequisite steps, then let's build the latest Thunderbird:
{% content-ref url="building-thunderbird/" %}
[building-thunderbird](building-thunderbird/)
{% endcontent-ref %}
```
--------------------------------
### Permissions Declaration
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/mailextensions/README.md
Declares the necessary permissions for an extension to access specific areas of Thunderbird. Users must accept these during installation.
```json
{
"permissions": [
"storage"
]
}
```
--------------------------------
### Replacing FileUtils.getFile()
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/tb128.md
Shows the recommended way to get a file path by replacing the removed `FileUtils.getFile()` method with `FileUtils.File()` and `PathUtils.join()`.
```javascript
let file = new FileUtils.File(PathUtils.join(PathUtils.tempDir, fileName));
```
--------------------------------
### Manifest.json Experiment Registration
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/mailextensions/experiments.md
Example of how to register an experiment API in the manifest.json file for a Thunderbird add-on. It specifies the schema file and the parent implementation script, along with scopes and event listeners.
```json
{
"experiment_apis": {
"LegacyPrefs": {
"schema": "api/LegacyPrefs/schema.json",
"parent": {
"scopes": ["addon_parent"],
"paths": [["LegacyPrefs"]],
"script": "api/LegacyPrefs/implementation.js",
"events": ["startup"]
}
}
}
}
```
--------------------------------
### Updating PATH for Cargo (Shell)
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Adds the Cargo binary directory (`$HOME/.cargo/bin`) to the system's PATH environment variable. This ensures that `cargo` and other Rust-related executables are discoverable by the shell after installation, resolving 'command not found' errors.
```Shell
export PATH=$HOME/.cargo/bin:$PATH
```
--------------------------------
### Rebuilding Lightning Calendar Extension with mach (Windows)
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/README.md
This example illustrates how to rebuild the Lightning calendar extension using ./mach build. It highlights the necessity of specifying the correct installation directory (comm/calendar/lightning), which might be a parent directory of the actual changed files, for successful incremental builds.
```Shell
./mach build comm/calendar/lightning
```
--------------------------------
### Install Python and Pipx using Homebrew
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Installs Python (version 3.8+) and pipx, a tool for installing Python applications in isolated environments, using the Homebrew package manager.
```bash
brew install python pipx
```
--------------------------------
### Thunderbird Add-on Window Loading Example
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/historical-overview/bootstrapped.md
This JavaScript code snippet demonstrates how to correctly handle window loading in a Thunderbird add-on. It uses the `Services.wm` to listen for new windows and ensures that operations are performed only after the window's document is fully loaded. It includes functions for initial loading, handling window readiness, and unloading.
```javascript
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
function install(data, reason) {
}
function uninstall(data, reason) {
}
function startup(data, reason) {
// Check if the window we want to modify is already open.
let windows = Services.wm.getEnumerator("mail:3pane");
while (windows.hasMoreElements()) {
let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
WindowListener.loadIntoWindow(domWindow);
}
// Wait for any new windows to open.
Services.wm.addListener(WindowListener);
}
function shutdown(data, reason) {
// When the application is shutting down we normally don't have to clean
// up any UI changes made.
if (reason == APP_SHUTDOWN) {
return;
}
let windows = Services.wm.getEnumerator("mail:3pane");
while (windows.hasMoreElements()) {
let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);
WindowListener.unloadFromWindow(domWindow);
}
// Stop listening for any new windows to open.
Services.wm.removeListener(WindowListener);
}
var WindowListener = {
async loadIntoWindow(window) {
console.log("load (1/2): " + window.document.readyState);
if (window.document.readyState != "complete") {
// Make sure the window load has completed.
await new Promise(resolve => {
window.addEventListener("load", resolve, { once: true });
});
}
this.loadIntoWindowAfterWindowIsReady(window);
},
loadIntoWindowAfterWindowIsReady(window) {
console.log("load (2/2): " + window.document.readyState);
// Check if the opened window is the one we want to modify.
if (window.document.documentElement
.getAttribute("windowtype") === "mail:3pane") {
let document = window.document;
// Take any steps to add UI or anything to the window
// document.getElementById() etc. will work here.
}
},
unloadFromWindow(window) {
console.log("unload: " + window.document.readyState);
let document = window.document;
// Take any steps to remove UI or anything from the window
// document.getElementById() etc. will work here.
},
// nsIWindowMediatorListener functions
onOpenWindow(xulWindow) {
// A new window has opened.
let domWindow = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
this.loadIntoWindow(domWindow);
},
onCloseWindow(xulWindow) {
},
onWindowTitleChange(xulWindow, newTitle) {
},
};
```
--------------------------------
### Install Mercurial on Fedora
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Installs the Mercurial version control system on Fedora Linux using the dnf package manager.
```bash
sudo dnf install mercurial
```
--------------------------------
### Thunderbird Add-on Guides
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/about-add-ons.md
Links to detailed guides for Thunderbird's supported add-on types: MailExtensions and Web Extension Themes.
```APIDOC
Add-On Guides:
For more detailed information on the two add-on types supported by Thunderbird, see their respective guides:
mailextensions
web-extension-themes.md
```
--------------------------------
### Scripted Source Code Download and Setup
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Automates the process of downloading Thunderbird source code, setting up the build environment, and configuring necessary files using a bootstrap script. It creates a 'tb-build' directory, downloads 'bootstrap.py', makes it executable, and runs it. It also includes instructions for switching to the 'central' Mercurial bookmark.
```bash
mkdir tb-build && cd tb-build
wget https://hg.mozilla.org/comm-central/raw-file/tip/python/rocboot/bin/bootstrap.py
chmod +x bootstrap.py
./bootstrap.py
hg up central
```
--------------------------------
### Thunderbird Extension Debugging Guide
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/resources/README.md
A comprehensive guide for debugging Thunderbird add-ons, adapted from Firefox debugging resources, providing the latest information.
```html
Debugging Guide
```
--------------------------------
### manifest.json Configuration
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/hello-world-add-on/using-content-scripts.md
Defines the structure and permissions for the Hello World extension. Includes browser-specific settings, action configurations, permissions, background script, and icons.
```json
{
"manifest_version": 2,
"name": "Hello World Example",
"description": "A basic Hello World example extension!",
"version": "4.0",
"author": "Thunderbird Team",
"browser_specific_settings": {
"gecko": {
"id": "helloworld@yoursite.com",
"strict_min_version": "128.0"
}
},
"browser_action": {
"default_popup": "mainPopup/popup.html",
"default_title": "Hello World",
"default_icon": "images/internet-32px.png"
},
"message_display_action": {
"default_popup": "messagePopup/popup.html",
"default_title": "Details",
"default_icon": "images/internet-32px.png"
},
"permissions": [
"messagesRead",
"messagesUpdate",
"accountsRead",
"storage",
"menus",
"notifications",
"messagesModify"
],
"background": {
"page": "background.html"
},
"icons": {
"64": "images/internet.png",
"32": "images/internet-32px.png",
"16": "images/internet-16px.png"
}
}
```
--------------------------------
### Resetting Repository
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/hello-world.md
Provides the command to reset the Thunderbird repository to its clean state, removing all local modifications. This is useful for reverting changes if errors occur during the development process.
```text
hg update --clean
```
--------------------------------
### Check Rust and Cargo Installation
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Verifies if Rust compiler (rustc) and package manager (cargo) are installed and accessible in the system's PATH.
```bash
which rustc
which cargo
```
--------------------------------
### Push to Try Server with Push-to-Try Extension
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/fixing-a-bug/try-server.md
Example command to push to the Thunderbird try server and trigger mochitest jobs for an artifact build using the push-to-try extension.
```bash
hg push-to-try -s ssh://hg.mozilla.org/try-comm-central -m "try: -b o -p all -u mochitest --artifact"
```
--------------------------------
### Thunderbird Extension Manifest
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/hello-world-add-on/README.md
The manifest.json file provides essential metadata for a Thunderbird extension, including its version, name, description, and browser-specific settings. It also defines browser actions like popups and icons.
```json
{
"manifest_version": 2,
"name": "Hello World Example",
"description": "A basic Hello World example extension!",
"version": "1.0",
"author": "Thunderbird Team",
"browser_specific_settings": {
"gecko": {
"id": "helloworld@yoursite.com",
"strict_min_version": "128.0"
}
},
"browser_action": {
"default_popup": "mainPopup/popup.html",
"default_title": "Hello World",
"default_icon": "images/internet-32px.png"
},
"icons": {
"64": "images/internet.png",
"32": "images/internet-32px.png",
"16": "images/internet-16px.png"
}
}
```
--------------------------------
### Install Mercurial on Ubuntu/Debian
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Installs the Mercurial version control system on Ubuntu or Debian-based Linux distributions using the apt package manager.
```bash
sudo apt install mercurial
```
--------------------------------
### Check Rust and Go Installation
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Commands to verify if Rust compiler (rustc) and Cargo (cargo) are installed and accessible in the system's PATH.
```shell
which rustc
```
```shell
which cargo
```
--------------------------------
### Try Syntax Commands
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/fixing-a-bug/try-server.md
Explains the various parameters used in try syntax to control build types, platforms, and test suites.
```APIDOC
Try Syntax Commands:
-b Build type:
- o: opt build (most common)
- d: debug build
- do: both opt and debug builds
-p Platform:
- linux: 32-bit Linux
- linux64: 64-bit Linux
- macosx64: Mac OS (use macosx64-shippable for no debug build)
- win32: 32-bit Windows
- win64: 64-bit Windows
- all: all platforms
-u Unit test suites:
- mochitest-thunderbird
- xpcshell
- marionette
- all
--artifact: Enables Artifact builds. See the Artifact Builds page for more information.
```
--------------------------------
### Popup CSS Styling
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/hello-world-add-on/README.md
The popup.css file provides styling for the extension's popup window. This example sets the font family, weight, height, and padding for the main content area.
```css
.popup-page {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-weight: bold;
height: 60px;
padding: 10px;
}
```
--------------------------------
### Thunderbird Bug Fixing Guide
Source: https://github.com/thunderbird/developer-docs/blob/master/SUMMARY.md
A comprehensive guide to fixing bugs in Thunderbird, covering bug triaging, version control with Mercurial, code linting, and patch submission.
```markdown
* [Fixing a Bug](thunderbird-development/fixing-a-bug/README.md)
* [Bug Triaging 101](thunderbird-development/fixing-a-bug/bug-triaging/README.md)
* [Bug Status Classicification](thunderbird-development/fixing-a-bug/bug-triaging/bug-status-classification.md)
* [Bug Types](thunderbird-development/fixing-a-bug/bug-triaging/bug-types.md)
* [Garbage Collection](thunderbird-development/fixing-a-bug/bug-triaging/garbage-collection.md)
* [Narrow the Scope](thunderbird-development/fixing-a-bug/bug-triaging/narrow-the-scope.md)
* [Using Mercurial Bookmarks](thunderbird-development/fixing-a-bug/using-mercurial-bookmarks.md)
* [Using Mercurial Queues](thunderbird-development/fixing-a-bug/using-mercurial-queues.md)
* [Lint and Format Code](thunderbird-development/fixing-a-bug/lint-and-format-code.md)
* [Using ESLint to Format Javascript Code](thunderbird-development/fixing-a-bug/using-eslint.md)
* [Try Server](thunderbird-development/fixing-a-bug/try-server.md)
* [Landing a Patch](thunderbird-development/fixing-a-bug/landing-a-patch.md)
* [Care and Feeding of the Tree](thunderbird-development/fixing-a-bug/care-and-feeding-of-the-tree.md)
```
--------------------------------
### Install Mercurial using Homebrew
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Installs Mercurial, a distributed version control system used by Mozilla for managing its source code repositories, via Homebrew.
```bash
brew install mercurial
```
--------------------------------
### Mach Bootstrap for Dependencies
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/windows-build-prerequisites.md
This command initiates the bootstrap process to download and install additional dependencies required for building Thunderbird. It prompts the user to select the desired build version.
```bash
./mach bootstrap
```
--------------------------------
### Thunderbird Menu Action Button Example
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/whats-new/README.md
An example demonstrating how to implement menu-typed action buttons in Thunderbird extensions. This showcases the functionality introduced in Thunderbird 115.
```html
See our example for more details.
```
--------------------------------
### Recommended mozconfig Options
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/README.md
Provides essential configuration options for the 'mozconfig' file to customize the Thunderbird build process, such as enabling debug builds, using ccache for faster builds, enabling clang-plugin, debug symbols, and autoclobber.
```ini
# Enable debug build
ac_add_options --enable-debug
# Speed up subsequent builds with ccache
ac_add_options --with-ccache=sccache
# Enable additional checks used in CI
ac_add_options --enable-clang-plugin
# Enable debug symbols
ac_add_options --enable-debug-symbols
# Enable autoclobber
mk_add_options AUTOCLOBBER=1
```
--------------------------------
### Run Mach Bootstrap for Thunderbird
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/linux-build-prerequisites.md
Executes the mach bootstrap command to fetch necessary dependencies for building Thunderbird. Users are prompted to select a Firefox build version.
```bash
./mach bootstrap
```
--------------------------------
### Installing Cbindgen with Cargo
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Installs `cbindgen`, a tool used to generate C headers from Rust code, using the Cargo package manager. This is crucial for interoperability between Rust and C/C++ components.
```Shell
cargo install cbindgen
```
--------------------------------
### Popup HTML Structure
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/hello-world-add-on/README.md
The popup.html file defines the user interface for the extension's popup window, which appears when the toolbar button is clicked. It includes basic HTML structure, links to CSS for styling, and a script for functionality.
```html
Hello World
Hello, World!
```
--------------------------------
### Example UI Injection
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/historical-overview/legacy-to-modern.md
An example demonstrating how to use the injectElements function to add a new tab and its associated panel to the Thunderbird UI, including localization for the tab label.
```javascript
injectElements(extension, window, `
`);
```
--------------------------------
### Automated Source Code Download and Bootstrap
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Downloads a bootstrap script, makes it executable, and runs it to fetch Thunderbird source code (mozilla-central and comm-central), run the initial bootstrap process, and set up a mozconfig file. This is a scripted approach to setting up the development environment.
```bash
mkdir tb-build && cd tb-build
wget https://hg.mozilla.org/comm-central/raw-file/tip/python/rocboot/bin/bootstrap.py
chmod +x bootstrap.py
./bootstrap.py
```
--------------------------------
### Thunderbird 128 Add-on Update Guide
Source: https://github.com/thunderbird/developer-docs/blob/master/add-ons/updating/tb128.md
This section details the changes required for add-ons to be compatible with Thunderbird 128. It covers API changes, Manifest V3 introduction, and Thunderbird core modifications.
```APIDOC
WebExtension API Changes (Thunderbird 115 to 128):
- Introduction of `messagesUpdate` permission, required for `messages.update()`.
Manifest V3 Introduction:
- Thunderbird 128 officially supports Manifest Version 3.
- Refer to WebExtension API documentation for changes required to convert from Manifest V2 to V3.
Thunderbird Core Changes:
- ESMification: JSM files are replaced by ES6 modules. Compatibility layer exists for `*.jsm` to `*.sys.mjs`.
- Loading ES6 modules: `ChromeUtils.importESModule("resource://gre/modules/XPCOMUtils.sys.mjs")`
- Defining ES6 module getters: `ChromeUtils.defineESModuleGetters(this, { AttachmentInfo: "resource:///modules/AttachmentInfo.sys.mjs" });`
- nsIMsgCopyServiceListener method renames (Thunderbird 126):
- `OnProgress()` -> `onProgress()`
- `OnStartCopy()` -> `onStartCopy()`
- `OnStopCopy()` -> `onStopCopy()`
- `GetMessageId()` -> `getMessageId()`
- `SetMessageKey()` -> `setMessageKey()`
- `thread-pane-columns.mjs` renamed to `ThreadPaneColumns.mjs` (Thunderbird 128).
- `nsIFilePicker::init()` parameter type change (Thunderbird 125):
- First parameter changed from `DOMWindow` to `BrowsingContext`.
- Access `BrowsingContext` via `window.browsingContext`.
- `FileUtils.getFile()` removed (Thunderbird 116):
- Replace with `new FileUtils.File(PathUtils.join(PathUtils.tempDir, fileName))`.
- Example: `let file = new FileUtils.File(PathUtils.join(PathUtils.tempDir, fileName));`
- `MailServices.accounts.FindAccountForServer()` renamed to `findAccountForServer()` (Thunderbird 121).
- `MozElements.NotificationBox.appendNotification()` became async (Thunderbird 123).
- `Services.jsm` removed (Thunderbird 128):
- Remove all code used to load this module.
- `Services.logins.addLogin()` replaced by `Services.logins.addLoginAsync()`.
- `XPCOMUtils.defineLazyGetter()` is a wrapper for `ChromeUtils.defineLazyGetter()` and may stop working.
```
--------------------------------
### Artifact Build Try Syntax
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/artifact-builds.md
Example of how to add the `--artifact` flag to your try syntax for artifact builds. This enables building from artifact artifacts instead of source.
```bash
try: -b o -p linux64,macosx64-shippable,win64 -u all --artifact
```
--------------------------------
### Run Thunderbird Build
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/README.md
Command to execute the built Thunderbird application. It can also accept command-line parameters, such as specifying a profile.
```bash
./mach run
```
--------------------------------
### Install MozPhab and Ensure Path
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/building-thunderbird/macos-build-prerequisites.md
Installs MozPhab, a tool for interfacing with Mozilla's Phabricator instance, using pipx. It also ensures that the necessary ~/.local/bin directory is added to the system's PATH environment variable.
```bash
pipx install MozPhab
pipx ensurepath
```
--------------------------------
### Getting Cell Text from a Tree Element in JavaScript
Source: https://github.com/thunderbird/developer-docs/blob/master/thunderbird-development/testing/writing-mochitest-tests.md
This snippet demonstrates how to retrieve the text content from a specific cell within a tree element. It accesses the tree's view and columns to get the cell text based on row and column numbers.
```JavaScript
// Get the text from a given cell in a tree:
let tree = document.getElementById("some-tree");
let rowNumber = 1;
let columnNumber = 1;
let cellText = tree.view.getCellText(rowNumber, tree.columns[columnNumber]);
```