Skip to content

Redefinition of function in context #9105

@arlolra

Description

@arlolra

Is this expected?

var vm = require("vm");
var ctx = vm.createContext();
ctx.console = console;
vm.runInContext("function red() { console.log('red'); }", ctx);
ctx.red();  // > red
vm.runInContext("function red() { console.log('green'); }", ctx);
ctx.red();  // > red

Pre- node v0.11.7, this used to log > green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.vmIssues and PRs related to the vm subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions