Skip to content

Commit

Permalink
test: failing behaviour on sandboxed Proxy
Browse files Browse the repository at this point in the history
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: nodejs/node#11671
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
  • Loading branch information
AnnaMag authored and andrew749 committed Jul 19, 2017
1 parent 79da204 commit 0bf687b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
20 changes: 20 additions & 0 deletions test/known_issues/test-vm-proxy-failure-CP.js
Original file line number Diff line number Diff line change
@@ -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));
13 changes: 0 additions & 13 deletions test/parallel/test-vm-proxies.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);

0 comments on commit 0bf687b

Please sign in to comment.