Skip to content

Commit

Permalink
inspector: forward errors from InspectorConsoleCall
Browse files Browse the repository at this point in the history
Do not assume that entering JS cannot fail.

PR-URL: #26113
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Eugene Ostroukhov <[email protected]>
Reviewed-By: Minwoo Jung <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax authored and rvagg committed Feb 28, 2019
1 parent 7d66d47 commit be671c3
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/inspector_js_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,22 @@ void InspectorConsoleCall(const FunctionCallbackInfo<Value>& info) {
CHECK(config_value->IsObject());
Local<Object> config_object = config_value.As<Object>();
Local<String> 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<Function>()->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<Function>()->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<Value> node_method = info[1];
Expand Down

0 comments on commit be671c3

Please sign in to comment.