-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
- Version: v6.0.0-pre (node-vee-eight-4.9, node-vee-eight-5.0)
- Platform: Linux ubuntu 4.2.0-35-generic Working with nvm, nvmw and similar installation managers #40-Ubuntu SMP Tue Mar 15 22:15:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Proxy object is not correctly contextified by vm.createContext routine.
I've tried to create vm with traps on global context, so I made one based on Proxy object.
Unfortunately, code executed inside vm doesn't have any access to built-ins.
> vm.runInNewContext("String", {})
[Function: String]
> vm.runInNewContext("String", new Proxy({},{}))
undefined
Passing required built-ins this way:
ctx = new Proxy({String:String}, {})
vm.runInNewContext("String", ctx)
seems to be (a bit dirty) workaround, but it doesn't resolve a problem at all...
vm.runInNewContext("String.prototype.f = function(){}; ''.f()", ctx)
... because passed String differs from used built-in by string literal, so this code raises an exception (''.f is undefined)
Tested on builds from branches node-vee-eight-4.9/5.0
Proxies doesn't work with older V8s and VMs, because of "not an object" bug.
Metadata
Metadata
Assignees
Labels
vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.