From be671c3bf51e704da26b5ae2378347de5d63188d Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Thu, 14 Feb 2019 23:56:50 +0100 Subject: [PATCH] inspector: forward errors from InspectorConsoleCall Do not assume that entering JS cannot fail. PR-URL: https://github.com/nodejs/node/pull/26113 Reviewed-By: Joyee Cheung Reviewed-By: Eugene Ostroukhov Reviewed-By: Minwoo Jung Reviewed-By: James M Snell --- src/inspector_js_api.cc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 73493a81cf0573..4a3272e9204995 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -158,16 +158,22 @@ void InspectorConsoleCall(const FunctionCallbackInfo& info) { CHECK(config_value->IsObject()); Local config_object = config_value.As(); Local in_call_key = FIXED_ONE_BYTE_STRING(isolate, "in_call"); - if (!config_object->Has(context, in_call_key).FromMaybe(false)) { - CHECK(config_object->Set(context, - in_call_key, - v8::True(isolate)).FromJust()); - CHECK(!inspector_method.As()->Call(context, - info.Holder(), - call_args.length(), - call_args.out()).IsEmpty()); + bool has_in_call; + if (!config_object->Has(context, in_call_key).To(&has_in_call)) + return; + if (!has_in_call) { + if (config_object->Set(context, + in_call_key, + v8::True(isolate)).IsNothing() || + inspector_method.As()->Call(context, + info.Holder(), + call_args.length(), + call_args.out()).IsEmpty()) { + return; + } } - CHECK(config_object->Delete(context, in_call_key).FromJust()); + if (config_object->Delete(context, in_call_key).IsNothing()) + return; } Local node_method = info[1];