Revert adding empty `window` object to node sandbox
parent
5865592943
commit
525b30c9bb
|
@ -39,7 +39,6 @@ let vm = new VM({
|
|||
clearTimeout,
|
||||
setInterval,
|
||||
URL,
|
||||
window: {},
|
||||
clearInterval,
|
||||
fetch: require(`${nodeModulesPath}/node-fetch`),
|
||||
WebSocket: require(`${nodeModulesPath}/ws`),
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue