docs: say what a closed window does to a tx or sign approval (closes #505)
The approval port's disconnect handler leaves a transaction or signing approval pending, and its comments said that was so the user could reopen the toolbar popup. Those approvals open in their own window. When that window closes, the windows.onRemoved listener rejects the approval, unless an approved attempt is still running, in which case that attempt answers the page. Both comments now say so. No code changed. Model: opus-5-5
This commit was merged in pull request #521.
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user