-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
- Version: v12.13.1
- Platform: Windows 10
The in
operator does not work correctly when using a Proxy as a VM context.
var o = {};
var p = new Proxy(o, {
has(target, key) {
console.log('has', key);
return Reflect.has(target, key);
},
get(target, key, receiver) {
console.log('get', key);
return Reflect.get(target, key, receiver);
},
});
vm.createContext(p);
vm.runInContext(`this.abcInThis = 'abc' in this`, p);
console.log(JSON.stringify(o)); // Prints {"abcInThis":false}
In the above code, the expected output is:
has abc
{"abcInThis":false}
but the actual output is:
get abc
{"abcInThis":true}
If we remove the get(target, key, receiver)
function, the still incorrect output is:
{"abcInThis":false}
Metadata
Metadata
Assignees
Labels
v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.