diff --git a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegateNew.cpp b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegateNew.cpp index 1ca7fdd2001499..79139846bc1d87 100644 --- a/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegateNew.cpp +++ b/packages/react-native/ReactCommon/hermes/inspector-modern/chrome/HermesRuntimeAgentDelegateNew.cpp @@ -74,6 +74,12 @@ class HermesRuntimeAgentDelegateNew::Impl final : public RuntimeAgentDelegate { if (sessionState.isLogDomainEnabled) { sendHermesIntegrationDescription(); } + if (sessionState.isRuntimeDomainEnabled) { + hermes_->enableRuntimeDomain(); + } + if (sessionState.isDebuggerDomainEnabled) { + hermes_->enableDebuggerDomain(); + } } bool handleRequest(const cdp::PreparsedRequest& req) override { diff --git a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp index 2415586f099a07..e8171ec625e52a 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp @@ -74,6 +74,16 @@ void HostAgent::handleRequest(const cdp::PreparsedRequest& req) { } else if (req.method == "Runtime.disable") { sessionState_.isRuntimeDomainEnabled = false; + shouldSendOKResponse = true; + isFinishedHandlingRequest = false; + } else if (req.method == "Debugger.enable") { + sessionState_.isDebuggerDomainEnabled = true; + + shouldSendOKResponse = true; + isFinishedHandlingRequest = false; + } else if (req.method == "Debugger.disable") { + sessionState_.isDebuggerDomainEnabled = false; + shouldSendOKResponse = true; isFinishedHandlingRequest = false; } diff --git a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h index a0329cc2db7b41..6a61ff5468524e 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/SessionState.h @@ -20,6 +20,7 @@ namespace facebook::react::jsinspector_modern { struct SessionState { public: // TODO: Generalise this to arbitrary domains + bool isDebuggerDomainEnabled{false}; bool isLogDomainEnabled{false}; bool isRuntimeDomainEnabled{false};