diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-12-08 17:31:57 +0300 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-12-13 06:30:20 +0300 |
commit | a1b283c2cacccb2e6d6f3a2382d986cd4ead11b4 (patch) | |
tree | 2ed047ec177c0584267cdddaabbdb944936335f9 /src/inspector_js_api.cc | |
parent | 9a2654601e58cb738463ea4a195400dd0cdd37ad (diff) |
src: create env->inspector_console_api_object earlier
Previously we create env->inspector_console_api_object() when
`process.binding('inspector')` is called, which may be too late
if the inspector console is used before the first call to
`process.binding('inspector')` - that is possible when
using `--inspect-brk-node`. Setting a breakpoint and using the
inspector console before that would crash the process.
This patch moves the initialization of the console API object to
the point when Environment is initialized so that
`installAdditionalCommandLineAPI()` can be essentially a noop
if we use the inspector console before the inspector binding
is initialized instead of crashing on an empty object.
PR-URL: https://github.com/nodejs/node/pull/24906
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'src/inspector_js_api.cc')
-rw-r--r-- | src/inspector_js_api.cc | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index ede39877264..f12cc3fb5ad 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -277,12 +277,6 @@ void Url(const FunctionCallbackInfo<Value>& args) { void Initialize(Local<Object> target, Local<Value> unused, Local<Context> context, void* priv) { Environment* env = Environment::GetCurrent(context); - { - auto obj = Object::New(env->isolate()); - auto null = Null(env->isolate()); - CHECK(obj->SetPrototype(context, null).FromJust()); - env->set_inspector_console_api_object(obj); - } Agent* agent = env->inspector_agent(); env->SetMethod(target, "consoleCall", InspectorConsoleCall); |