fix(pwa): clear the leftover app badge from the page, not the worker

A badge call from the service worker stalled Chromium's worker thread
while it activated, awaited or not: the worker reached "activated" but
never claimed its pages, so no page was ever controlled and every
offline path was gone. The worker no longer touches the badge. The
installed app clears a leftover count from the page once the worker is
registered; a browser tab leaves it alone.

The filter-sync test no longer reads `history.length`, which the
browser caps; the recorded push without a replace already proves the
new entry.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 15:28:37 +01:00
1 parent 45a5d4e353
commit 80ee228899
5 files changed
+61 -18

No files matched your search

+4 -2
View File
@@ -482,13 +482,15 @@ describe("sw.js — activate", () => {
expect(harness.navPreload.enabled).toBe(true);
});
it("clears the dose count an earlier release left on the app icon", async () => {
it("leaves the app icon badge to the page, never touches it while activating", async () => {
// A badge call from the worker can stall Chromium's worker thread, so the
// activation never claims its pages. The page clears a leftover count.
const harness = bootServiceWorker();
const { badge } = swFakes(harness);
await dispatchActivate(harness);
expect(badge.cleared).toBe(true);
expect(badge.cleared).toBe(false);
});
});