mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 08:02:31 +00:00
* fix(browser): prevent window.close guest crashes * fix(browser): guard close before inline scripts * fix(browser): preserve explicit window close policy
21 lines
616 B
TypeScript
21 lines
616 B
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { installBrowserWindowCloseGuard } from './browser-window-close-installation'
|
|
|
|
describe('browser window close preload', () => {
|
|
afterEach(() => {
|
|
vi.unstubAllGlobals()
|
|
})
|
|
|
|
it('installs a non-replaceable window.close no-op in the page world', () => {
|
|
const nativeClose = vi.fn()
|
|
vi.stubGlobal('window', { close: nativeClose })
|
|
|
|
installBrowserWindowCloseGuard()
|
|
|
|
expect(window.close()).toBeUndefined()
|
|
expect(window.close).not.toBe(nativeClose)
|
|
expect(Reflect.set(window, 'close', nativeClose)).toBe(false)
|
|
})
|
|
})
|