fix: closing a transaction or signature approval window leaves the request pending (closes #673)
Closing a transaction or signature approval window no longer rejects the request; only Cancel does. The browser can close that window when the user clicks away, for example to copy the password from a password manager. The request stays pending and the site gets no answer. Pressing the toolbar button opens the oldest such request, unless an approved attempt still holds it. A Reject the background refuses keeps the window open with the background's message. The worker points the toolbar back at the wallet when it starts. While such a request waits, the transaction slot stays held, so another site's eth_sendTransaction gets -32002. An address switch still rejects pending approvals with 4001. Model: opus-5-5
This commit was merged in pull request #676.
This commit is contained in:
@@ -512,7 +512,10 @@ window of its own, and the password is required to be absent from every message
|
||||
the approval window sends to the background — with the message that would carry
|
||||
it required to be present, so that check cannot pass by observing nothing. That
|
||||
last one is the standing floor under
|
||||
[#157](https://git.eeqj.de/sneak/AutistMask/issues/157).
|
||||
[#157](https://git.eeqj.de/sneak/AutistMask/issues/157). Closing a transaction
|
||||
or signature approval window is required to leave the dApp's request unanswered.
|
||||
The suite then opens that approval at the URL the toolbar button holds, and
|
||||
answers it there.
|
||||
|
||||
The limits of that coverage and of the rest of the Chrome suite, none of them
|
||||
papered over:
|
||||
@@ -521,9 +524,9 @@ papered over:
|
||||
network with real funds; that remains a human pass before 1.0.0.
|
||||
- The site-connection prompt is raised through `chrome.action.openPopup()`, and
|
||||
headless Chromium's browser-action popup is not a page Playwright can see or
|
||||
click, so that one prompt is driven at the URL the extension itself puts on
|
||||
the action — the same page and the same approval id, but whether a real
|
||||
toolbar click shows it is not observable here.
|
||||
click. So that prompt, and an approval reopened after its window closed, are
|
||||
opened in a tab at the URL the extension puts on the action. Whether a real
|
||||
toolbar click shows that page is not observable here.
|
||||
- Each site-connection request is made 1.5 seconds after the tab it will be
|
||||
driven in is opened (`APPROVAL_TAB_SETTLE_MS` in `tests/e2e/run.js`), because
|
||||
opening that tab closes the previous prompt's toolbar popup; a request made
|
||||
@@ -642,15 +645,24 @@ above, it does not fail on page errors.
|
||||
|
||||
`make test-e2e-firefox` builds `dist/firefox/` and drives the **real popup in a
|
||||
real Firefox**, installed as an unpacked MV2 temporary add-on via geckodriver.
|
||||
It covers popup load, the StateRecovery screen (the same cases as the Chrome
|
||||
suite), wallet creation through the UI, the Add Token screen, and the dApp round
|
||||
trips — `eth_requestAccounts`, `personal_sign`, `wallet_switchEthereumChain`
|
||||
rejected and then approved, `eth_sendTransaction`, and a closed approval window
|
||||
rejecting with EIP-1193 4001 — driven through the real content script,
|
||||
background page and approval windows. The popup open all along is required to
|
||||
show the `[TESTNET]` banner once the switch to Sepolia is approved and to drop
|
||||
it once the switch back is. The `personal_sign` prompt is also required to fit
|
||||
its window without scrolling sideways, with the extension's pages at 170% zoom.
|
||||
It covers:
|
||||
|
||||
- popup load
|
||||
- the StateRecovery screen, with the same cases as the Chrome suite
|
||||
- wallet creation through the UI
|
||||
- the Add Token screen
|
||||
- `eth_requestAccounts` from a dApp
|
||||
- `personal_sign` from a dApp
|
||||
- `wallet_switchEthereumChain` from a dApp, rejected and then approved
|
||||
- `eth_sendTransaction` from a dApp
|
||||
- an approval window closed without an answer, which leaves its request pending
|
||||
until it is rejected
|
||||
|
||||
Each dApp request runs through the real content script and background page, and
|
||||
opens a real approval window. The popup open all along is required to show the
|
||||
`[TESTNET]` banner once the switch to Sepolia is approved and to drop it once
|
||||
the switch back is. The `personal_sign` prompt is also required to fit its
|
||||
window without scrolling sideways, with the extension's pages at 170% zoom.
|
||||
|
||||
The suite lives in `tests/e2e/firefox/`. Its WebDriver client (`driver.js`) has
|
||||
**no npm dependencies at all**: it is built on global `fetch` and
|
||||
@@ -2644,8 +2656,14 @@ view would leave a wallet one click from deletion.
|
||||
Data Model) → full-sentence error on the error line saying why, nothing
|
||||
signed (no screen change)
|
||||
- "Reject" → closes popup (returns rejection to background)
|
||||
- Popup window closed without answering → the request is rejected with
|
||||
EIP-1193 code 4001
|
||||
- "Reject" after "Confirm", while the transaction is being sent → the
|
||||
background's message on the error line, no screen change
|
||||
- Popup window closed without answering → the request stays pending, and the
|
||||
site gets no answer. The browser can close this window when the user
|
||||
clicks away from it, for example to copy the password from a password
|
||||
manager. Until the request is answered, the toolbar button opens this
|
||||
screen instead of the wallet. When several requests wait with their
|
||||
windows closed, the toolbar button opens the oldest first.
|
||||
|
||||
#### SignApproval (`approve-sign`)
|
||||
|
||||
@@ -2734,8 +2752,11 @@ view would leave a wallet one click from deletion.
|
||||
- "Sign" (wrong password, or a signing failure) → error line, no screen
|
||||
change
|
||||
- "Reject" → closes popup (returns rejection to background)
|
||||
- Popup window closed without answering → the request is rejected with
|
||||
EIP-1193 code 4001
|
||||
- "Reject" after "Sign", while the signature is being checked → the
|
||||
background's message on the error line, no screen change
|
||||
- Popup window closed without answering → the request stays pending, as on
|
||||
TxApproval. Until the request is answered, the toolbar button opens this
|
||||
screen instead of the wallet.
|
||||
|
||||
#### NetworkApproval (`approve-network`)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user