summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-14 23:56:50 +0100
committerAnna Henningsen <anna@addaleax.net>2019-02-17 17:50:55 +0100
commit009efd0ec398455b7563020a684ef0c9f7f213a2 (patch)
tree7aea964747aa28e11e0db263f81d5c4856172f82 /src
parent0896fbedf8e6e008ecd8671c06a0a7761139e1d0 (diff)
downloadandroid-node-v8-009efd0ec398455b7563020a684ef0c9f7f213a2.tar.gz
android-node-v8-009efd0ec398455b7563020a684ef0c9f7f213a2.tar.bz2
android-node-v8-009efd0ec398455b7563020a684ef0c9f7f213a2.zip
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 <joyeec9h3@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/inspector_js_api.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc
index 48ebd73817..e94f42c18e 100644
--- a/src/inspector_js_api.cc
+++ b/src/inspector_js_api.cc
@@ -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];