fix: a site allowed without Remember stays connected when the background worker idles (closes #526) #568

Merged
clawbot merged 1 commits from issue-526-session-connections into next 2026-10-18 23:59:25 +02:00
Collaborator

Fixes #526.

A connection allowed without "Remember my choice for this site" lived in a module-level object in src/background/index.js, so it ended the first time Chrome stopped the idle background worker. Each such connection is now one item in the browser's session storage (storage.session, key origin:address), which outlives the worker and is emptied when the browser closes. The background reads and writes it through sessionStorageGet/Set/Remove, added to src/shared/browserApi.js beside the storage.local wrappers. Removal in Settings, address switch, address removal and wallet removal still end it.

What a reviewer might trip over:

  • One item per connection, so making one is a single write and two never overwrite each other. Ending one reads the items, then removes some.
  • Settings now waits for the background's answer to AUTISTMASK_REMOVE_SITE before drawing the lists again; otherwise it could list the site before the removal lands.
  • On an address switch, pending approvals are rejected before the connections end, because ending now waits on storage.
  • tests/support/storageStub.js gains a session area. The Settings stub in tests/backgroundApproval.test.js now hands back the background's answer when it is sent, as the browser does.
  • tests/e2e/slowApproval.js now connects its site without "Remember" and asks eth_accounts once Chrome has stopped the worker.

New file: tests/connectedSitesWorkerRestart.test.js, in tests/.

Disclosures:

  • manifest/firefox.json declared no minimum version; it now declares 115.0, the first Firefox with session storage.
  • Judgement call: address and wallet removal still tell the background without waiting, so those connections end one storage round trip after the message.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/AutistMask/issues/526. A connection allowed without "Remember my choice for this site" lived in a module-level object in `src/background/index.js`, so it ended the first time Chrome stopped the idle background worker. Each such connection is now one item in the browser's session storage (`storage.session`, key `origin:address`), which outlives the worker and is emptied when the browser closes. The background reads and writes it through `sessionStorageGet`/`Set`/`Remove`, added to `src/shared/browserApi.js` beside the `storage.local` wrappers. Removal in Settings, address switch, address removal and wallet removal still end it. What a reviewer might trip over: - One item per connection, so making one is a single write and two never overwrite each other. Ending one reads the items, then removes some. - Settings now waits for the background's answer to `AUTISTMASK_REMOVE_SITE` before drawing the lists again; otherwise it could list the site before the removal lands. - On an address switch, pending approvals are rejected before the connections end, because ending now waits on storage. - `tests/support/storageStub.js` gains a session area. The Settings stub in `tests/backgroundApproval.test.js` now hands back the background's answer when it is sent, as the browser does. - `tests/e2e/slowApproval.js` now connects its site without "Remember" and asks `eth_accounts` once Chrome has stopped the worker. New file: `tests/connectedSitesWorkerRestart.test.js`, in `tests/`. Disclosures: - `manifest/firefox.json` declared no minimum version; it now declares 115.0, the first Firefox with session storage. - Judgement call: address and wallet removal still tell the background without waiting, so those connections end one storage round trip after the message. Model: opus-5-5
clawbot added 1 commit 2026-10-18 22:59:18 +02:00
fix: a site allowed without Remember stays connected when the background worker idles (closes #526)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run
234c6c4032
A connection allowed without "Remember my choice for this site" was held
in a module-level object in the background worker. Chrome stops the worker
after about 30 seconds idle, so the connection ended at the first idle
spell. Each such connection is now one item in the browser's session
storage, which outlives the worker but not the browser, read and written
through new wrappers in src/shared/browserApi.js. Settings now waits for
the background to end a removed site's connections before listing the
connected sites again. The Firefox manifest declares 115.0, the first
version with session storage, as its minimum.

Model: opus-5-5
clawbot self-assigned this 2026-10-18 23:04:11 +02:00
clawbot added the needs-review label 2026-10-18 23:04:12 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 8b0a1bff02 into next 2026-10-18 23:59:25 +02:00
clawbot deleted branch issue-526-session-connections 2026-10-18 23:59:26 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/AutistMask#568