fix: a popup reload mid-refresh no longer logs the requests it cancels #476

Merged
clawbot merged 1 commits from issue-218-reload-mid-refresh into next 2026-10-06 09:43:11 +02:00
Collaborator

Closes #218.

Cause. Reproduced by reloading the popup repeatedly mid-refresh. Chrome fires pagehide on the old page, then cancels its open requests. In the page a cancelled fetch() rejects with the same TypeError: Failed to fetch as an unreachable server, so loadHomeTxs, fetchTokenBalances and, less often, the ETH balance and ENS name lookups each logged it with console.error, which the harness counts as a failure.

Fix. src/popup/index.js aborts an AbortController on pagehide. Its signal reaches loadHomeTxs (as ctx.pageClosed) and refreshBalances(), and each failure report checks signal.aborted first. Nothing looks at the message, so a real failure is still reported. The background worker passes no signal and logs as before.

Tests.

  • e2e: reloads the popup twice with Blockscout held (holdBlockscout), so the transaction list and token balances are in flight at the second reload; any console.error fails it. Against the unfixed code it logs all four errors.
  • e2e: the transaction list fails as a network error (failTransactionList); the test declares loadHomeTxs failed: Failed to fetch and Chrome's own report of the failed request.
  • tests/balanceRefreshCancelled.test.js: the balance refresh logs these failures while the signal is live, not once it is aborted.

awaitRelease() in tests/e2e/network.js now takes the switch name.

  • Not covered, same cause: the address and token screens and the new-wallet address scan, #475. The new e2e tests sit after the transaction detail tests so that scan has finished.
  • Judgement call: the real-failure test waits for the ten-second refresh, because a reload draws the list more than once.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/AutistMask/issues/218. **Cause.** Reproduced by reloading the popup repeatedly mid-refresh. Chrome fires `pagehide` on the old page, then cancels its open requests. In the page a cancelled `fetch()` rejects with the same `TypeError: Failed to fetch` as an unreachable server, so `loadHomeTxs`, `fetchTokenBalances` and, less often, the ETH balance and ENS name lookups each logged it with `console.error`, which the harness counts as a failure. **Fix.** `src/popup/index.js` aborts an `AbortController` on `pagehide`. Its signal reaches `loadHomeTxs` (as `ctx.pageClosed`) and `refreshBalances()`, and each failure report checks `signal.aborted` first. Nothing looks at the message, so a real failure is still reported. The background worker passes no signal and logs as before. **Tests.** - e2e: reloads the popup twice with Blockscout held (`holdBlockscout`), so the transaction list and token balances are in flight at the second reload; any `console.error` fails it. Against the unfixed code it logs all four errors. - e2e: the transaction list fails as a network error (`failTransactionList`); the test declares `loadHomeTxs failed: Failed to fetch` and Chrome's own report of the failed request. - `tests/balanceRefreshCancelled.test.js`: the balance refresh logs these failures while the signal is live, not once it is aborted. `awaitRelease()` in `tests/e2e/network.js` now takes the switch name. - Not covered, same cause: the address and token screens and the new-wallet address scan, https://git.eeqj.de/sneak/AutistMask/issues/475. The new e2e tests sit after the transaction detail tests so that scan has finished. - Judgement call: the real-failure test waits for the ten-second refresh, because a reload draws the list more than once. Model: opus-5-5
clawbot self-assigned this 2026-10-06 07:57:22 +02:00
clawbot added 1 commit 2026-10-06 07:57:22 +02:00
fix: a popup reload mid-refresh no longer logs the requests it cancels (closes #218)
check / check (push) Successful in 2m54s
e2e / e2e-chrome (push) Successful in 6m6s
e2e / e2e-firefox (push) Successful in 2m41s
226c99d0db
Chrome cancels a closing popup's open requests just after pagehide, and in
the page a cancelled fetch() fails with the same "Failed to fetch" as a
server that cannot be reached. The home screen's transaction list and the
balance refresh logged an error for each, and the e2e suite failed on them.

The popup now aborts an AbortController on pagehide, and those failure
reports check its signal first. End-to-end tests reload the popup with
Blockscout held and require nothing logged, and fail the transaction list
for real and require the failure reported; a unit test covers the balance
refresh. The address and token screens and the new-wallet address scan are
#475.

Model: opus-5-5
clawbot added the needs-review label 2026-10-06 07:57:26 +02:00
Author
Collaborator

PASS

Model: opus-5-5

PASS Model: opus-5-5
clawbot merged commit 329e64a54d into next 2026-10-06 09:43:11 +02:00
clawbot deleted branch issue-218-reload-mid-refresh 2026-10-06 09:43:12 +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#476