Commit dadf02907ad for nodejs
commit dadf02907ad08339728019070f4b86afb82130d0
Author: Chengzhong Wu <legendecas@gmail.com>
Date: Tue Nov 10 15:31:13 2026 -0500
src: adopt FallthroughCallback signature of Dispatchable
Signed-off-by: Chengzhong Wu <cwu631@bloomberg.net>
PR-URL: https://github.com/nodejs/node/pull/66653
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 408c754e3e9..a86fde0e14f 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -335,21 +335,28 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
std::vector<uint8_t> cbor_buffer;
ConvertJSONToCBOR(crdtp::SpanFrom(raw_message), &cbor_buffer);
- Dispatchable dispatchable(crdtp::SpanFrom(cbor_buffer));
+ // TODO(legendecas): The fallthrough callback captures a raw `this`. That is
+ // safe only while every command in node_protocol_config.json is
+ // synchronous. An async command stores the callback and may invoke it
+ // after this session is gone, so add a lifetime guard before adding one.
+ Dispatchable dispatchable(
+ crdtp::SpanFrom(cbor_buffer),
+ std::string_view(),
+ [this](int call_id,
+ crdtp::span<uint8_t> method,
+ crdtp::span<uint8_t> serialized_message,
+ std::string_view associated_data) {
+ per_process::Debug(DebugCategory::INSPECTOR_SERVER,
+ "[inspector] method not found\n");
+ node_dispatcher_->SendMethodNotFound(call_id, method);
+ });
crdtp::span<uint8_t> method = dispatchable.Method();
if (v8_inspector::V8InspectorSession::canDispatchMethod(
StringView(method.data(), method.size()))) {
session_->dispatchProtocolMessage(message);
return;
}
- UberDispatcher::DispatchResult result =
- node_dispatcher_->Dispatch(dispatchable);
- if (!result.MethodFound()) {
- per_process::Debug(DebugCategory::INSPECTOR_SERVER,
- "[inspector] method not found\n");
- // Fall through to send a method not found error.
- }
- result.Run();
+ node_dispatcher_->Dispatch(dispatchable);
}
void schedulePauseOnNextStatement(const std::string& reason) {
@@ -442,13 +449,6 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel,
sendMessageToFrontend(json);
}
- // crdtp::FrontendChannel
- void FallThrough(int call_id,
- crdtp::span<uint8_t> method,
- crdtp::span<uint8_t> message) override {
- DCHECK(false);
- }
-
std::unique_ptr<protocol::RuntimeAgent> runtime_agent_;
#ifndef V8_USE_PERFETTO
std::unique_ptr<protocol::TracingAgent> tracing_agent_;