test: add known issue for vm module

GlobalPropertySetterCallback() does not check the
property on the sandbox. It wrongly throws an error
instead of updating `x`.

PR-URL: https://github.com/nodejs/node/pull/14661
Ref: https://github.com/nodejs/node/issues/12300
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
This commit is contained in:
Franziska Hinkelmann authored and Myles Borins committed 2017-09-12 03:17:09 +02:00
1 parent f34e0f97e7
commit 34d1a779b1
1 file changed
+17
+17
View File
@@ -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);