mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
710 B
17 lines
710 B
8 years ago
|
'use strict';
|
||
|
// https://github.com/nodejs/node/issues/10223
|
||
|
|
||
|
require('../common');
|
||
|
const assert = require('assert');
|
||
|
const vm = require('vm');
|
||
|
|
||
|
const ctx = vm.createContext();
|
||
|
vm.runInContext('Object.defineProperty(this, "x", { value: 42 })', ctx);
|
||
|
assert.strictEqual(ctx.x, undefined); // Not copied out by cloneProperty().
|
||
|
assert.strictEqual(vm.runInContext('x', ctx), 42);
|
||
|
vm.runInContext('x = 0', ctx); // Does not throw but x...
|
||
|
assert.strictEqual(vm.runInContext('x', ctx), 42); // ...should be unaltered.
|
||
|
assert.throws(() => vm.runInContext('"use strict"; x = 0', ctx),
|
||
|
/Cannot assign to read only property 'x'/);
|
||
|
assert.strictEqual(vm.runInContext('x', ctx), 42);
|