Closed
Description
Version
v22.5.0
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
vm
What steps will reproduce the bug?
"use strict";
const vm = require("vm");
class EventTarget {
addEventListener() {}
}
const windowConstructor = function () {};
Object.setPrototypeOf(windowConstructor, EventTarget);
const windowPrototype = Object.create(EventTarget.prototype);
function Window() {
vm.createContext(this);
this._globalProxy = vm.runInContext("this", this);
Object.setPrototypeOf(this, windowPrototype);
const window = this;
Object.defineProperty(this, "window", {
get() {
return window._globalProxy;
},
enumerable: true,
configurable: true
});
}
const window = new Window();
console.log(vm.runInContext(`"addEventListener" in window`, window));
How often does it reproduce? Is there a required condition?
Every time
What is the expected behavior? Why is that the expected behavior?
Outputs true. (That occurs on v22.4.1.)
What do you see instead?
Outputs false
Additional information
No response