Skip to content

Commit

Permalink
test: add known issue for vm module
Browse files Browse the repository at this point in the history
GlobalPropertySetterCallback() does not check the
property on the sandbox. It wrongly throws an error
instead of updating `x`.

PR-URL: #14661
Ref: #12300
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
  • Loading branch information
fhinkel authored and MylesBorins committed Sep 20, 2017
1 parent 644d990 commit 1e231ba
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/known_issues/test-vm-strict-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';
// https://github.com/nodejs/node/issues/12300

require('../common');
const assert = require('assert');
const vm = require('vm');

const ctx = vm.createContext({ x: 42 });

// The following line wrongly throws an
// error because GlobalPropertySetterCallback()
// does not check if the property exists
// on the sandbox. It should just set x to 1
// instead of throwing an error.
vm.runInContext('"use strict"; x = 1', ctx);

assert.strictEqual(ctx.x, 1);

0 comments on commit 1e231ba

Please sign in to comment.