From 7316d650736beb75e8bc66f305080aa2f20e798c Mon Sep 17 00:00:00 2001 From: AnnaMag Date: Thu, 2 Mar 2017 16:03:54 +0000 Subject: [PATCH] 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 Reviewed-By: Franziska Hinkelmann --- test/known_issues/test-vm-proxy-failure-CP.js | 20 +++++++++++++++++++ test/parallel/test-vm-proxies.js | 13 ------------ 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 test/known_issues/test-vm-proxy-failure-CP.js diff --git a/test/known_issues/test-vm-proxy-failure-CP.js b/test/known_issues/test-vm-proxy-failure-CP.js new file mode 100644 index 00000000000000..de644599b233b8 --- /dev/null +++ b/test/known_issues/test-vm-proxy-failure-CP.js @@ -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)); diff --git a/test/parallel/test-vm-proxies.js b/test/parallel/test-vm-proxies.js index 25e16e8f5ccc55..266b212fb827b8 100644 --- a/test/parallel/test-vm-proxies.js +++ b/test/parallel/test-vm-proxies.js @@ -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/);