From c5f67bc31e6c38b5b361b789e9d55135a34bdf99 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:10:22 -0400 Subject: [PATCH] Document Brave service worker workaround --- js/webtorrent.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/webtorrent.js b/js/webtorrent.js index a912c834..da8fa5af 100644 --- a/js/webtorrent.js +++ b/js/webtorrent.js @@ -92,7 +92,15 @@ export class TorrentClient { throw new Error("Service Worker not supported or disabled"); } - // Brave-specific logic + // Brave-specific logic: Brave Shields has a long-standing bug where + // stale service worker registrations linger even after we ship fixes. + // When that happens, the outdated worker keeps intercepting requests + // and WebTorrent fails to spin up, leaving playback broken until the + // user manually nukes the registration. To guarantee a clean slate we + // blanket-unregister every worker, then pause briefly so Brave can + // finish tearing down the old instance before we register the fresh + // one again. That delay is intentional—future tweaks should not shorten + // or remove it without understanding the regression risk. if (isBraveBrowser) { this.log("Checking Brave configuration..."); if (!navigator.serviceWorker) {