This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
runInNewContext does not pass properties that Enumerable= false #1402
Closed
Description
example:
var vm= require('vm');
var ctx = {};
Object.defineProperty(ctx, 'myNonEnumerablePropery', { value: 1 });
vm.runInNewContext('var result=typeof myNonEnumerablePropery', ctx);
console.log(ctx.result);
var ctx = {};
Object.defineProperty(ctx, 'myNonEnumerablePropery', { value: 1 , enumerable:true });
vm.runInNewContext('var result=typeof myNonEnumerablePropery', ctx);
console.log(ctx.result);
test case:
function node_script_cc_runInNewContext_ignores_non_enumerable()
{
var assert=require('assert');
var vm= require('vm');
var ctx = {};
Object.defineProperty(ctx, 'myNonEnumeratiblePropery', { value: 1 });
vm.runInNewContext('var result=typeof myNonEnumeratiblePropery', ctx);
assert.equal(ctx.result,'number', "runInNewContext ignores non enumerable ");
}
node_script_cc_runInNewContext_ignores_non_enumerable()