mirror of
https://github.com/stablyai/orca.git
synced 2026-09-24 00:02:24 +00:00
* fix(browser): prevent window.close guest crashes * fix(browser): guard close before inline scripts * fix(browser): preserve explicit window close policy
16 lines
348 B
TypeScript
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 {}
|
|
}
|
|
}
|