Skip to content

Commit 94b8b9a

Browse files
committed
Fix window.open infinite loop
1 parent bbd8b27 commit 94b8b9a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/vscode/src/fill/windowsService.ts

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ import { client } from "../client";
1010
import { showOpenDialog } from "../dialog";
1111
import { workbench } from "../workbench";
1212

13+
// VS Code overrides window.open to call openExternal, but we then call
14+
// window.open which results in an infinite loop. Store the function but also
15+
// make it unable to be set (doesn't work otherwise).
16+
const windowOpen = window.open;
17+
Object.defineProperty(window, "open", {
18+
set: (): void => { /* Not allowed. */ },
19+
get: (): Function => windowOpen,
20+
});
21+
1322
/**
1423
* Instead of going to the shared process, we'll directly run these methods on
1524
* the client. This setup means we can only control the current window.

0 commit comments

Comments
 (0)