fix: unref browser download approval timeout (#4246)

This commit is contained in:
Neil 2026-05-31 09:31:43 -07:00 committed by GitHub
parent 4c5bfe5c32
commit d39fc28565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -938,6 +938,11 @@ export class BrowserManager {
download.pendingCancelTimer = setTimeout(() => {
this.cancelDownloadInternal(downloadId, 'Timed out waiting for user approval.')
}, 60_000)
// Why: approval timeout is a fail-closed safety net, not a reason to keep
// Electron main alive after the browser/runtime is otherwise shutting down.
if (typeof download.pendingCancelTimer.unref === 'function') {
download.pendingCancelTimer.unref()
}
}
getDownloadPrompt(downloadId: string, senderWebContentsId: number): { filename: string } | null {