diff options
author | Shelley Vohr <shelley.vohr@gmail.com> | 2020-09-01 05:51:09 +0300 |
---|---|---|
committer | Shelley Vohr <shelley.vohr@gmail.com> | 2020-09-04 21:18:33 +0300 |
commit | 89f2d465cb4ced4fe27725f38ec6143e19136e7b (patch) | |
tree | 46ae86529c7655d3f2596b9c12a7e25ecbf8d2e8 | |
parent | 8bdbacf39b8d51f747a8d8960af8b808d3cf2668 (diff) |
src: add get/set pair for env context awareness
PR-URL: https://github.com/nodejs/node/pull/35024
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
-rw-r--r-- | src/env-inl.h | 8 | ||||
-rw-r--r-- | src/env.h | 3 | ||||
-rw-r--r-- | src/node_binding.cc | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/env-inl.h b/src/env-inl.h index 44fa1125a3c..de3d651fa7d 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -513,6 +513,14 @@ inline bool Environment::abort_on_uncaught_exception() const { return options_->abort_on_uncaught_exception; } +inline void Environment::set_force_context_aware(bool value) { + options_->force_context_aware = value; +} + +inline bool Environment::force_context_aware() const { + return options_->force_context_aware; +} + inline void Environment::set_abort_on_uncaught_exception(bool value) { options_->abort_on_uncaught_exception = value; } diff --git a/src/env.h b/src/env.h index b1367c2660f..16546fdd494 100644 --- a/src/env.h +++ b/src/env.h @@ -1068,6 +1068,9 @@ class Environment : public MemoryRetainer { void PrintSyncTrace() const; inline void set_trace_sync_io(bool value); + inline void set_force_context_aware(bool value); + inline bool force_context_aware() const; + // This stores whether the --abort-on-uncaught-exception flag was passed // to Node. inline bool abort_on_uncaught_exception() const; diff --git a/src/node_binding.cc b/src/node_binding.cc index 9890f9e7be9..0d577a8c8e8 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -470,7 +470,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) { if (mp != nullptr) { if (mp->nm_context_register_func == nullptr) { - if (env->options()->force_context_aware) { + if (env->force_context_aware()) { dlib->Close(); THROW_ERR_NON_CONTEXT_AWARE_DISABLED(env); return false; |