diff options
author | Gus Caplan <me@gus.host> | 2018-02-26 14:29:41 -0600 |
---|---|---|
committer | Gus Caplan <me@gus.host> | 2018-03-12 14:39:21 -0500 |
commit | cb5f358ee7461f191db8c88e0af26023558f5232 (patch) | |
tree | f23e34d68a09fb05d044f00bd795575db63a9370 /doc/api/vm.md | |
parent | a03c90b661f69200f124718b56b55b0cb3506c71 (diff) | |
download | node-new-cb5f358ee7461f191db8c88e0af26023558f5232.tar.gz |
vm: add code generation options
Adds options to a VM Context to disable code generation from strings
(such as eval or new Function) and WASM code generation
(WebAssembly.compile).
PR-URL: https://github.com/nodejs/node/pull/19016
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'doc/api/vm.md')
-rw-r--r-- | doc/api/vm.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/vm.md b/doc/api/vm.md index 12e35e9f72..b9ccf93b7b 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -495,6 +495,14 @@ added: v0.3.1 value of the [`url.origin`][] property of a [`URL`][] object. Most notably, this string should omit the trailing slash, as that denotes a path. **Default:** `''`. + * `contextCodeGeneration` {Object} + * `strings` {boolean} If set to false any calls to `eval` or function + constructors (`Function`, `GeneratorFunction`, etc) will throw an + `EvalError`. + **Default**: `true`. + * `wasm` {boolean} If set to false any attempt to compile a WebAssembly + module will throw a `WebAssembly.CompileError`. + **Default**: `true`. First contextifies the given `sandbox`, runs the compiled code contained by the `vm.Script` object within the created sandbox, and returns the result. @@ -578,6 +586,14 @@ added: v0.3.1 the [`url.origin`][] property of a [`URL`][] object. Most notably, this string should omit the trailing slash, as that denotes a path. **Default:** `''`. + * `codeGeneration` {Object} + * `strings` {boolean} If set to false any calls to `eval` or function + constructors (`Function`, `GeneratorFunction`, etc) will throw an + `EvalError`. + **Default**: `true`. + * `wasm` {boolean} If set to false any attempt to compile a WebAssembly + module will throw a `WebAssembly.CompileError`. + **Default**: `true`. If given a `sandbox` object, the `vm.createContext()` method will [prepare that sandbox][contextified] so that it can be used in calls to |