Revert adding empty `window` object to node sandbox

pull/66/head
Zef Hemel 2022-08-01 09:01:00 +02:00
parent 5865592943
commit 525b30c9bb
2 changed files with 1 additions and 10 deletions

View File

@ -39,7 +39,6 @@ let vm = new VM({
clearTimeout,
setInterval,
URL,
window: {},
clearInterval,
fetch: require(`${nodeModulesPath}/node-fetch`),
WebSocket: require(`${nodeModulesPath}/ws`),

View File

@ -11,16 +11,8 @@ let pendingRequests = new Map<
}
>();
let isWorker = false;
if (typeof window === "undefined") {
// @ts-ignore
window = {};
isWorker = true;
}
function workerPostMessage(msg: ControllerMessage) {
if (!isWorker && window.parent !== window) {
if (typeof window !== "undefined" && window.parent !== window) {
window.parent.postMessage(msg, "*");
} else {
self.postMessage(msg);