diff --git a/src/background/index.js b/src/background/index.js index 8620482..00fa439 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -633,8 +633,9 @@ function isExtensionSender(sender) { // had refused. // // TX and sign approvals do not decide here. They stay pending across a -// disconnect — the user can reopen the toolbar popup — and are rejected by the -// windows.onRemoved listener below. +// disconnect. When their window closes, the windows.onRemoved listener below +// rejects them, unless an approved attempt is still running, in which case +// that attempt answers the page. runtime.onConnect.addListener((port) => { if (port.name.startsWith("approval:")) { const id = port.name.split(":")[1]; @@ -662,7 +663,9 @@ runtime.onConnect.addListener((port) => { const approval = pendingApprovals[id]; if (approval) { if (approval.type === "tx" || approval.type === "sign") { - // Keep pending — user can reopen the toolbar popup + // When its window closes, windows.onRemoved rejects it, + // unless an approved attempt is still running, in which + // case that attempt answers the page. return; } settleApproval(id, { approved: false, remember: false });