With the inclusion of nodejs/node#16293 we need to make some additional changes to properly support vm.runInContext.
When running vm.runInContext(code, context) the context object is intended to act like the global object for the duration of the code. Currently I believe we do this by creating a proxy around the context object, creating a new global object, and then setting the prototype of the new global object to the the proxy of the context object.
Prior to the upstream changes, there was a step that copied properties from the global inside the context back to the context object. In fact, we already mishandled this somewhat: In node-chakracore, you could do this:
var vm = require("vm");
var sb = {}
vm.createContext(sb);
vm.runInContext("", sb);
sb.Object // sb now has the Object property from the context when it shouldn't
With the upstream changes, that step has been removed in favor of new v8 support for additional interceptors. I've tried adding implementations for those interceptors, but our current approach to configuring the context doesn't end up with them being called: modifications are made to the global context object, and it does not defer to the proxy that is its prototype.
It seems like we should probably be reversing the relationship here, with the sandbox object (or its proxy) deferring to the global object as its prototype instead, so modifications can be intercepted by the native code and persisted as appropriate.