0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-vm-proxies.js
AnnaMag 6473737bb1 test: failing behaviour on sandboxed Proxy
CopyProperties() causes sandboxed Proxy to throw error
when in fact no code has been run. The function will
be removed with the updates to the V8 API.

Here, failing Proxy test case is moved to known_issues.

PR-URL: https://github.com/nodejs/node/pull/11671
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2017-03-17 09:44:41 -07:00

19 lines
646 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const vm = require('vm');
// src/node_contextify.cc filters out the Proxy object from the parent
// context. Make sure that the new context has a Proxy object of its own.
let sandbox = {};
vm.runInNewContext('this.Proxy = Proxy', sandbox);
assert.strictEqual(typeof sandbox.Proxy, 'function');
assert.notStrictEqual(sandbox.Proxy, Proxy);
// Unless we copy the Proxy object explicitly, of course.
sandbox = { Proxy: Proxy };
vm.runInNewContext('this.Proxy = Proxy', sandbox);
assert.strictEqual(typeof sandbox.Proxy, 'function');
assert.strictEqual(sandbox.Proxy, Proxy);