inspector: fix connectToMainThread() abort without parent inspector · nodejs/node@697980b · GitHub
Skip to content

Commit 697980b

Browse files
codebytereaduh95
authored andcommitted
inspector: fix connectToMainThread() abort without parent inspector
`inspector.Session#connectToMainThread()` in a Worker aborted the process on `CHECK_NOT_NULL(parent_handle_)` in `Agent::ConnectToMainThread()` when the parent Environment was created with `kNoCreateInspector`, as embedders that run their own inspector (or none) do. Throw the new `ERR_INSPECTOR_NOT_AVAILABLE` in that case, next to the existing throw for a Worker whose own inspector is not initialized. Refs: #35025 Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: #65976 Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent caa7858 commit 697980b

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎src/inspector_agent.cc‎

Lines changed: 5 additions & 1 deletion

‎src/node_errors.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details);
9696
V(ERR_HEAP_PROFILE_HAVE_BEEN_STARTED, Error) \
9797
V(ERR_HEAP_PROFILE_NOT_STARTED, Error) \
9898
V(ERR_ILLEGAL_CONSTRUCTOR, Error) \
99+
V(ERR_INSPECTOR_NOT_AVAILABLE, Error) \
99100
V(ERR_INVALID_ADDRESS, Error) \
100101
V(ERR_INVALID_ARG_VALUE, TypeError) \
101102
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \

‎test/cctest/test_environment.cc‎

Lines changed: 21 additions & 0 deletions

0 commit comments

Comments
 (0)