summaryrefslogtreecommitdiff
path: root/src/node_contextify.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-03-16 15:23:39 +0100
committerMichaël Zasso <targos@protonmail.com>2018-04-03 17:59:22 +0200
commit34d988f122c206da692b5c39ec5342fec22b60ab (patch)
treee1735f265ea1d0d936b5aab6985d9d48389af05b /src/node_contextify.h
parenta820f4155b5e9a742fec750b437036dcd98d3271 (diff)
downloadnode-new-34d988f122c206da692b5c39ec5342fec22b60ab.tar.gz
vm: move options checks from C++ to JS
Also introduces stronger type validations for options passed to vm functions. PR-URL: https://github.com/nodejs/node/pull/19398 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_contextify.h')
-rw-r--r--src/node_contextify.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/node_contextify.h b/src/node_contextify.h
index cf3e6452fd..1075bc5c68 100644
--- a/src/node_contextify.h
+++ b/src/node_contextify.h
@@ -9,6 +9,13 @@
namespace node {
namespace contextify {
+struct ContextOptions {
+ v8::Local<v8::String> name;
+ v8::Local<v8::String> origin;
+ v8::Local<v8::Boolean> allow_code_gen_strings;
+ v8::Local<v8::Boolean> allow_code_gen_wasm;
+};
+
class ContextifyContext {
protected:
Environment* const env_;
@@ -17,11 +24,11 @@ class ContextifyContext {
public:
ContextifyContext(Environment* env,
v8::Local<v8::Object> sandbox_obj,
- v8::Local<v8::Object> options_obj);
+ const ContextOptions& options);
v8::Local<v8::Value> CreateDataWrapper(Environment* env);
v8::Local<v8::Context> CreateV8Context(Environment* env,
- v8::Local<v8::Object> sandbox_obj, v8::Local<v8::Object> options_obj);
+ v8::Local<v8::Object> sandbox_obj, const ContextOptions& options);
static void Init(Environment* env, v8::Local<v8::Object> target);
static bool AllowWasmCodeGeneration(