mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user