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.
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.
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.