summaryrefslogtreecommitdiff
path: root/test/parallel/test-vm-strict-mode.js
diff options
context:
space:
mode:
authorFranziska Hinkelmann <franziska.hinkelmann@gmail.com>2017-10-17 17:27:27 +0200
committerFranziska Hinkelmann <franziska.hinkelmann@gmail.com>2017-10-23 14:35:09 +0200
commitf1d6b04ac95abe9ddbb6817b215bcdc6bef33ada (patch)
tree3c605508487f859d3d7f101f4ccbe441443e5eac /test/parallel/test-vm-strict-mode.js
parent556ebab30e171c2941deb529a42ad47301972af5 (diff)
downloadandroid-node-v8-f1d6b04ac95abe9ddbb6817b215bcdc6bef33ada.tar.gz
android-node-v8-f1d6b04ac95abe9ddbb6817b215bcdc6bef33ada.tar.bz2
android-node-v8-f1d6b04ac95abe9ddbb6817b215bcdc6bef33ada.zip
src: use new V8 API in vm module
Remove the CopyProperties() hack in the vm module, i.e., Contextify. Use different V8 API methods, that allow interception of DefineProperty() and do not flatten accessor descriptors to property descriptors. Move many known issues to test cases. Factor out the last test in test-vm-context.js for https://github.com/nodejs/node/issues/10223 into its own file, test-vm-strict-assign.js. Part of this CL is taken from a stalled PR by https://github.com/AnnaMag https://github.com/nodejs/node/pull/13265 This PR requires a backport of https://chromium.googlesource.com/v8/v8/+/37a3a15c3e52e2146e45f41c427f24414e4d7f6f PR-URL: https://github.com/nodejs/node/pull/16293 Fixes: https://github.com/nodejs/node/issues/2734 Fixes: https://github.com/nodejs/node/issues/10223 Fixes: https://github.com/nodejs/node/issues/11803 Fixes: https://github.com/nodejs/node/issues/11902 Ref: https://github.com/nodejs/node/issues/6283 Ref: https://github.com/nodejs/node/pull/15114 Ref: https://github.com/nodejs/node/pull/13265 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'test/parallel/test-vm-strict-mode.js')
-rw-r--r--test/parallel/test-vm-strict-mode.js27
1 files changed, 0 insertions, 27 deletions
diff --git a/test/parallel/test-vm-strict-mode.js b/test/parallel/test-vm-strict-mode.js
deleted file mode 100644
index f3820d8aea..0000000000
--- a/test/parallel/test-vm-strict-mode.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-require('../common');
-const assert = require('assert');
-const vm = require('vm');
-const ctx = vm.createContext();
-
-// Test strict mode inside a vm script, i.e., using an undefined variable
-// throws a ReferenceError. Also check that variables
-// that are not successfully set in the vm, must not be set
-// on the sandboxed context.
-
-vm.runInContext('w = 1;', ctx);
-assert.strictEqual(1, ctx.w);
-
-assert.throws(function() { vm.runInContext('"use strict"; x = 1;', ctx); },
- /ReferenceError: x is not defined/);
-assert.strictEqual(undefined, ctx.x);
-
-vm.runInContext('"use strict"; var y = 1;', ctx);
-assert.strictEqual(1, ctx.y);
-
-vm.runInContext('"use strict"; this.z = 1;', ctx);
-assert.strictEqual(1, ctx.z);
-
-// w has been defined
-vm.runInContext('"use strict"; w = 2;', ctx);
-assert.strictEqual(2, ctx.w);