Archived
1
0

Fix window.open infinite loop

This commit is contained in:
Asher 2019-04-08 17:36:49 -05:00
parent bbd8b27fc7
commit 94b8b9a5cf
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC

View File

@ -10,6 +10,15 @@ import { client } from "../client";
import { showOpenDialog } from "../dialog"; import { showOpenDialog } from "../dialog";
import { workbench } from "../workbench"; import { workbench } from "../workbench";
// VS Code overrides window.open to call openExternal, but we then call
// window.open which results in an infinite loop. Store the function but also
// make it unable to be set (doesn't work otherwise).
const windowOpen = window.open;
Object.defineProperty(window, "open", {
set: (): void => { /* Not allowed. */ },
get: (): Function => windowOpen,
});
/** /**
* Instead of going to the shared process, we'll directly run these methods on * Instead of going to the shared process, we'll directly run these methods on
* the client. This setup means we can only control the current window. * the client. This setup means we can only control the current window.