diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-09-12 15:01:50 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-09-17 17:20:27 +0200 |
commit | 4286dcf17f062034117043a2640b620210b61f57 (patch) | |
tree | de227e8bb7bee72778a2e7bd98f08991839bf866 /src/inspector_js_api.cc | |
parent | c33e27dc3caf5a5b7954706fe6ecde1e4f82534d (diff) | |
download | node-new-4286dcf17f062034117043a2640b620210b61f57.tar.gz |
src: refactor `Environment::GetCurrent()` usage
Make `Environment::GetCurrent()` return `nullptr` if the current
`Context` is not a Node.js context, and for the relevant usage of
this function, either:
- Switch to the better `GetCurrent(args)` variant
- Turn functions in to no-ops where it makes sense
- Make it a `CHECK`, i.e. an API requirement, where it make sense
- Leave a `TODO` comment for verifying what, if anything, is to be done
PR-URL: https://github.com/nodejs/node/pull/22819
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'src/inspector_js_api.cc')
-rw-r--r-- | src/inspector_js_api.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 18b9e61075..54b7c4d01c 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -149,12 +149,11 @@ void CallAndPauseOnStart(const FunctionCallbackInfo<v8::Value>& args) { } void InspectorConsoleCall(const FunctionCallbackInfo<Value>& info) { - Isolate* isolate = info.GetIsolate(); - HandleScope handle_scope(isolate); + Environment* env = Environment::GetCurrent(info); + Isolate* isolate = env->isolate(); Local<Context> context = isolate->GetCurrentContext(); CHECK_LT(2, info.Length()); SlicedArguments call_args(info, /* start */ 3); - Environment* env = Environment::GetCurrent(isolate); if (InspectorEnabled(env)) { Local<Value> inspector_method = info[0]; CHECK(inspector_method->IsFunction()); |