Thunderbird/Betterbird add-on (Manifest V3): typing inside a quote splits the quote and inserts your own text with a marker such as [OH]:. - English and German user interface - Licensed under the Mozilla Public License 2.0 - English documentation, JSDoc lint gate, 87 tests (node:test + jsdom)
7.0 KiB
Guide: Develop and test the add-on
This guide covers everything from a fresh clone to a release: build, load the add-on into Thunderbird, debug it and check the package the way addons.thunderbird.net (ATN) does.
Prerequisites
- Node.js 22 or later with npm (see
enginesinpackage.json). - zip (Info-ZIP) and bash, used by
scripts/build.shto pack the.xpi. On Windows, use Git Bash or WSL and make surezipis on thePATH. - Thunderbird 128 or later (or Betterbird) for loading and testing the add-on.
- Any editor. Formatting is done by Prettier (
npm run format), so no editor settings are needed.
Get the code
git clone https://git.hassio-muc.de/Oliver_Herb/inline-comment.git
cd inline-comment
npm install
npm install only installs development tools (Prettier, ESLint, jsdom). The add-on itself has no
runtime dependencies.
Everyday commands
npm test # unit and DOM tests (node:test + jsdom), no Thunderbird needed
npm run lint # ESLint: JavaScript checks and JSDoc rules
npm run format # format all files with Prettier
npm run check # format check + lint + tests, run before every push
npm run build # check + dist/inline-comment-<version>.xpi
Run a single test file with node --test test/marker.test.js.
The lint configuration is in eslint.config.mjs: the recommended rule sets of ESLint and
eslint-plugin-jsdoc, reported as errors, plus a JSDoc block with typed @param and @returns
tags for every named function. Inline callbacks are exempt. Each part of the code gets the globals
of the environment it runs in (Thunderbird extension scripts, the shared src/lib/ scripts or
Node).
The .xpi is a plain ZIP of src/ plus the LICENSE file. There is no bundler, no transpiler and
no minification: every file from src/ goes into the package unchanged.
Repository layout
| Path | Content |
|---|---|
src/manifest.json |
Manifest V3, permissions, version |
src/background.js |
Registers the compose script, toolbar button, configuration per window |
src/compose/ |
Compose script: catches typing inside a quote and inserts the comment |
src/lib/ |
Testable logic (settings, marker, quote handling, i18n) as classic scripts |
src/options/ |
Options page |
src/_locales/ |
English and German UI texts |
test/ |
Automated tests |
scripts/build.sh |
Packs the .xpi |
listing/ |
Texts for the addons.thunderbird.net listing |
.docs/, .plan/ |
Architecture, decisions, guides, roadmap |
Background: architecture overview.
Load the add-on in Thunderbird
Temporarily (until Thunderbird is restarted):
- Open
about:debugging(menuTools > Developer Tools > Debug Add-ons, or the gear menu in the Add-ons Manager) and select This Thunderbird. - Click Load Temporary Add-on… and select
dist/inline-comment-<version>.xpi. Alternatively selectsrc/manifest.jsonto load the sources directly without building. - After a new build or a change in
src/, click Reload next to the add-on. - Open a new compose window, for example a reply to a message that contains a quote.
Permanently: open the Add-ons Manager (Tools > Add-ons and Themes), click the gear icon,
choose Install Add-on From File… and select the .xpi. Thunderbird and Betterbird do not
enforce add-on signatures, so the unsigned build installs this way. A version installed from ATN
with the same add-on ID (inline-comment@ih-engineering.de) is replaced.
Debugging
- Background script: in
about:debugging > This Thunderbird, click Inspect next to Inline Comment. The toolbox shows the console of the background script, the debugger and, under Storage, the extension storage (keysettingsinstorage.local). - Compose script: it runs inside the editor of each compose window. Its messages appear in the
Error Console:
Tools > Developer Tools > Error Consoleor Ctrl+Shift+J. - Debug output: enable Diagnostic output in the error console in the options (section
Advanced) for detailed messages from the compose script. They are written with
console.debug; if they do not show up, check that the console filter includes debug messages. - All messages of the add-on start with
[Inline Comment], so the console can be filtered by that text.
Manual test
The automated tests run in jsdom without a real mail editor. Before a release, work through the manual test plan in Thunderbird: testplan.md.
Release a new version
-
Make the change with tests and run
npm run check. -
Raise the version in
package.jsonandsrc/manifest.json(Semantic Versioning) and add a section for it toCHANGELOG.md.test/manifest.test.jschecks that all three match. -
Update the documentation (
README.md,README.de.md,.docs/and, if the behaviour or the permissions changed,listing/) in the same commit. -
Run
npm run buildand work through the manual test plan with the new.xpi. -
Validate the package as described in the next section.
-
Commit, tag and push:
git commit -am "Release 0.3.0" git tag -a v0.3.0 -m "Inline Comment 0.3.0" git push origin main v0.3.0 -
Upload the
.xpito ATN as a new version. Use theCHANGELOG.mdsection as release notes. The listing texts are in listing/.
Validate the package for ATN
ATN checks every upload with Mozilla's addons-linter, as of November 2026 version 6.15.x (ATN's
server pins ~6.15.0). Run the same version locally against the built package:
npx addons-linter@6.15.0 dist/inline-comment-<version>.xpi
- ATN accepts the upload when the linter reports 0 errors. Warnings are shown to the reviewer but do not block the upload.
- Expected warnings:
MANIFEST_PERMISSIONSforcomposeandaccountsRead. These are Thunderbird permissions that the Firefox-oriented linter does not know, so the warnings are false positives. - Any other warning should be fixed or explained in the notes to reviewers (listing/notes-to-reviewers.md).
Optional: Thunderbird's own webext-linter knows the Thunderbird APIs and permissions and checks against the ATN review policies:
git clone https://github.com/thunderbird/webext-linter.git
cd webext-linter
npm install
node verify.js <path-to>/dist/inline-comment-<version>.xpi