From e5f89222a36373a837b0430cfe56b839c378b8f3 Mon Sep 17 00:00:00 2001 From: wagesj45 Date: Sun, 19 Apr 2026 01:56:14 -0500 Subject: [PATCH] Use Thunderbird background scripts for MV3 --- docs/psitransfer-notes.md | 2 +- manifest.json | 4 +++- src/background.js | 2 +- src/psitransfer/client.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/psitransfer-notes.md b/docs/psitransfer-notes.md index 2c997a9..d164edb 100644 --- a/docs/psitransfer-notes.md +++ b/docs/psitransfer-notes.md @@ -106,7 +106,7 @@ This document records the PsiTransfer behavior inferred from the local source at - A stable public delete endpoint for previously uploaded files suitable for Thunderbird `onFileDeleted`. - A stable public rename endpoint suitable for Thunderbird `onFileRename`. - Whether the Thunderbird provider should upload one file per bucket or group related files into a shared bucket. PsiTransfer is bucket-oriented, while Thunderbird `cloudFile` uploads are file-oriented. -- Whether Thunderbird MV3 background service workers expose every browser primitive expected by the vendored `tus-js-client` bundle in all supported Thunderbird versions. The current implementation assumes the vendored bundle runs in the background worker. +- Whether Thunderbird MV3 background scripts expose every browser primitive expected by the vendored `tus-js-client` bundle in all supported Thunderbird versions. The current implementation assumes the vendored bundle runs in the background context. ## Implemented minimal-v1 mapping diff --git a/manifest.json b/manifest.json index c7f6674..c8ec4b3 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,9 @@ "https://*/*" ], "background": { - "service_worker": "src/background.js", + "scripts": [ + "src/background.js" + ], "type": "module" }, "cloud_file": { diff --git a/src/background.js b/src/background.js index 9dc3d6a..2386938 100644 --- a/src/background.js +++ b/src/background.js @@ -26,5 +26,5 @@ async function bootstrap() { } bootstrap().catch(caughtError => { - logError("Failed to bootstrap background service worker", caughtError); + logError("Failed to bootstrap background script", caughtError); }); diff --git a/src/psitransfer/client.js b/src/psitransfer/client.js index 1d55fc5..241ac0d 100644 --- a/src/psitransfer/client.js +++ b/src/psitransfer/client.js @@ -106,7 +106,7 @@ export class PsiTransferClient { }; if (!tus?.Upload) { - throw new Error("Vendored tus client did not load. Verify vendor/tus.js is packaged and accessible to the background service worker."); + throw new Error("Vendored tus client did not load. Verify vendor/tus.js is packaged and accessible to the background context."); } }