Skip to content
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
@shimondoodkin

Description

@shimondoodkin

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions