mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
20
test/known_issues/test-vm-proxy-failure-CP.js
Normal file
20
test/known_issues/test-vm-proxy-failure-CP.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
// Sandbox throws in CopyProperties() despite no code being run
|
||||
// Issue: https://github.com/nodejs/node/issues/11902
|
||||
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const vm = require('vm');
|
||||
|
||||
const handler = {
|
||||
getOwnPropertyDescriptor: (target, prop) => {
|
||||
throw new Error('whoops');
|
||||
}
|
||||
};
|
||||
const sandbox = new Proxy({foo: 'bar'}, handler);
|
||||
const context = vm.createContext(sandbox);
|
||||
|
||||
|
||||
assert.doesNotThrow(() => vm.runInContext('', context));
|
||||
@@ -16,16 +16,3 @@ sandbox = { Proxy: Proxy };
|
||||
vm.runInNewContext('this.Proxy = Proxy', sandbox);
|
||||
assert.strictEqual(typeof sandbox.Proxy, 'function');
|
||||
assert.strictEqual(sandbox.Proxy, Proxy);
|
||||
|
||||
// Handle a sandbox that throws while copying properties
|
||||
assert.throws(() => {
|
||||
const handler = {
|
||||
getOwnPropertyDescriptor: (target, prop) => {
|
||||
throw new Error('whoops');
|
||||
}
|
||||
};
|
||||
const sandbox = new Proxy({foo: 'bar'}, handler);
|
||||
const context = vm.createContext(sandbox);
|
||||
|
||||
vm.runInContext('', context);
|
||||
}, /whoops/);
|
||||
|
||||
Reference in New Issue
Block a user