Files
orca/src/preload/browser-window-close-installation.ts
T
Neil c79b859758 fix(browser): prevent window.close guest crashes (#11910)
* fix(browser): prevent window.close guest crashes

* fix(browser): guard close before inline scripts

* fix(browser): preserve explicit window close policy
2026-08-01 03:08:11 -07:00

16 lines
348 B
TypeScript

export function installBrowserWindowCloseGuard(): void {
const ignoreWindowClose = (): void => {}
try {
Object.defineProperty(window, 'close', {
configurable: false,
enumerable: false,
writable: false,
value: ignoreWindowClose
})
} catch {
try {
window.close = ignoreWindowClose
} catch {}
}
}