Closed
Description
- Version: current master
- Platform: OS X
- Subsystem: vm
Data properties defined with the Object.defineProperty call inside the vm context are not copied onto the sandbox in the current master.
Test:
'use strict';
require('../common');
var vm = require('vm');
const util = require('util');
const sandbox = {};
const context = vm.createContext(sandbox);
const code = `
Object.defineProperty(this, "foo", {value: 5});
`;
const res = vm.runInContext(code, context);
console.log(util.inspect(sandbox)); // returns: {}
In v6.2.0 (homebrew installation):
> node test_setter.js
{ foo: 5 }
Debugging the core shows failure in GlobalPropertySetterCallback.
ctx->sandbox()->Set(property, value);
does not set 'foo' on the sandbox (property and value are as expected). 'foo' is present on the global object, but also not returned by
Local<Array> names = global->GetOwnPropertyNames(context).ToLocalChecked();
in CopyProperties.
Metadata
Metadata
Assignees
Labels
No labels