Open bytespider opened 1 year ago
Looked at this for a little, some notes:
this
value to the DirectEvalExeuctable. How does it choose one? Should we use IndirectEvalExecutable instead? Or should we wrap the scripts in a closure? Looking at the Node code, it seems like they add getters/setters to the global scope that proxy back. Other than that research I have no idea how any of this works 😀
Just wanted to follow-up to this as I've been doing a lot of happy-dom stuff lately, and it uses the VM's context to run eval code in a simulated browser way, but as soon as the object is passed to createContext() the 'this' at the end of execution is altered (rendering errors galore). Ref: https://github.com/capricorn86/happy-dom/issues/1225
Latest Bun 1.0.26, latest happy-dom 13.3.8
import VM from 'vm';
class Test {
test() { // just a test method }
constructor() {
this.test();
this.init();
// "this" is no longer 'this', and throws a tantrum ....
this.test();
}
init() {
if (!VM.isContext(this)) {
VM.createContext(this);
}
}
}
test = new Test();
any news ?
Still happening on version 1.1.9 😢
Any news? Still happening in v1.1.20
this is blocking use of happydom
happy-dom
is not happy anymore, could bun team rise the priority?
Still not working on the latest canary. How can we get the priority up in here?
What version of Bun is running?
0.7.3
What platform is your computer?
Darwin 22.6.0 arm64 arm
What steps can reproduce the bug?
Properties from the context are not available on the globalThis or this properties.
What is the expected behavior?
In Node v18.7.0
What do you see instead?
In Bun 0.7.3
Additional information
No response