Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Inconsistent behaviour in vm.runInNewContext() #478

@alexlamsl

Description

@alexlamsl
  • Version: 8.9.4 (also tested 8.6.0
  • Platform: Windows 10 x64
  • Subsystem: vm

The test case in mishoo/UglifyJS#2574 uncovers a difference in exceptional behaviour between node and node-chakracore - here's a reduced test case:

test.js

var code = [
    "try {",
    "    var a = A, b = 1;",
    "    throw a;",
    "} catch (e) {",
    "    console.log(b);",
    "}",
].join("\n");
eval(code);
require("vm").runInNewContext(code, { console: console });

node-chakracore

$ nvs use chakracore
$ node test.js
undefined
1

node

$ nvs use node/0.10
$ node test.js
undefined
undefined
$ nvs use node/0.12
$ node test.js
undefined
undefined
$ nvs use node/4
$ node test.js
undefined
undefined
$ nvs use node/6
$ node test.js
undefined
undefined
$ nvs use node/8
$ node test.js
undefined
undefined
$ nvs use node/9
$ node test.js
undefined
undefined

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions