mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 03:31:35 +00:00

In the implementation of the vm module, if a property is successfully deleted on the sandbox, we also need to delete it on the global_proxy object. Therefore, we must not call args.GetReturnValue().Set(). We only intercept, i.e., call args.GetReturnValue().Set(), in the DeleterCallback, if Delete() failed, e.g. because the property was read only. PR-URL: https://github.com/nodejs/node/pull/11266 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
16 lines
348 B
JavaScript
16 lines
348 B
JavaScript
'use strict';
|
|
// Refs: https://github.com/nodejs/node/issues/6287
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const vm = require('vm');
|
|
|
|
const context = vm.createContext();
|
|
const res = vm.runInContext(`
|
|
this.x = 'prop';
|
|
delete this.x;
|
|
Object.getOwnPropertyDescriptor(this, 'x');
|
|
`, context);
|
|
|
|
assert.strictEqual(res, undefined);
|