Skip to content

vm: strict mode ReferenceError with assignment to context property #12300

Closed
@bnoordhuis

Description

@bnoordhuis

Split off from #5344 (comment).

'use strict';
const vm = require('vm');
const ctx = vm.createContext({ x: 42 });

try {
  const result = vm.runInContext('"use strict"; x = 1', ctx);
} catch(e) {
  console.log(e.stack);
  console.log('x is', ctx.x)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    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