diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-09-20 15:43:19 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-05-10 15:15:17 +0300 |
commit | bcb324c3ffd74147041cf892a0b2840aa340c248 (patch) | |
tree | dd5c72e9c70ad18f8853d0f0a0a1781ad8e97e5d /src/node_contextify.cc | |
parent | 61fd027096c0416a6e9bbe3ee7b7edb4c180725a (diff) |
src: add can_call_into_js flag
This prevents calls back into JS from the shutdown phase.
Many thanks for Stephen Belanger for reviewing the original version of
this commit in the Ayo.js project.
Refs: https://github.com/ayojs/ayo/pull/82
PR-URL: https://github.com/nodejs/node/pull/19377
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_contextify.cc')
-rw-r--r-- | src/node_contextify.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 4db82d4d7ca..23582454cd6 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -820,6 +820,8 @@ class ContextifyScript : public BaseObject { const bool display_errors, const bool break_on_sigint, const FunctionCallbackInfo<Value>& args) { + if (!env->can_call_into_js()) + return false; if (!ContextifyScript::InstanceOf(env, args.Holder())) { env->ThrowTypeError( "Script methods can only be called on script instances."); |