From 1a9780f0e3714ac18ffae34cb67376c711b0e031 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 2 Dec 2024 08:27:52 -0800 Subject: [PATCH] Remove FuseboxClient CDP domain (#48004) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48004 Follows https://github.com/facebook/react-native/pull/47962 and depends on https://github.com/facebookexperimental/rn-chrome-devtools-frontend/pull/139. Updates the modern debugger server to no longer respond to `FuseboxClient` messages — namely `FuseboxClient.setClientMetadata`. This method is replaced by `ReactNativeApplication.enable` for identifying the React Native DevTools frontend. Changelog: [General][Breaking] - The `FuseboxClient.setClientMetadata` CDP method is removed. Instead, use `ReactNativeApplication.enable`. Reviewed By: rubennorte Differential Revision: D66575324 fbshipit-source-id: f2b4cbacd857931832d89305510f5aaf51df483a --- .../ReactCommon/jsinspector-modern/HostAgent.cpp | 14 -------------- .../ReactCommon/jsinspector-modern/HostAgent.h | 1 - .../tests/JsiIntegrationTest.cpp | 15 --------------- 3 files changed, 30 deletions(-) diff --git a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp index cf37a23ff6dc97..7a3d07be504997 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp @@ -123,15 +123,6 @@ void HostAgent::handleRequest(const cdp::PreparsedRequest& req) { .message = message, }); - shouldSendOKResponse = true; - isFinishedHandlingRequest = true; - } else if (req.method == "FuseboxClient.setClientMetadata") { - fuseboxClientType_ = FuseboxClientType::Fusebox; - - if (sessionState_.isLogDomainEnabled) { - sendFuseboxNotice(); - } - shouldSendOKResponse = true; isFinishedHandlingRequest = true; } else if (req.method == "ReactNativeApplication.enable") { @@ -192,16 +183,11 @@ HostAgent::~HostAgent() { } void HostAgent::sendFuseboxNotice() { - if (fuseboxNoticeLogged_) { - return; - } - static constexpr auto kFuseboxNotice = ANSI_COLOR_BG_YELLOW "Welcome to " ANSI_WEIGHT_BOLD "React Native DevTools" ANSI_WEIGHT_RESET ""sv; sendInfoLogEntry(kFuseboxNotice); - fuseboxNoticeLogged_ = true; } void HostAgent::sendNonFuseboxNotice() { diff --git a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.h b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.h index 7aa388ea591c81..78a7c4c0eed9df 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.h +++ b/packages/react-native/ReactCommon/jsinspector-modern/HostAgent.h @@ -102,7 +102,6 @@ class HostAgent final { const HostTargetMetadata hostMetadata_; std::shared_ptr instanceAgent_; FuseboxClientType fuseboxClientType_{FuseboxClientType::Unknown}; - bool fuseboxNoticeLogged_{false}; bool isPausedInDebuggerOverlayVisible_{false}; /** diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp index 16846bb8c241e7..9ae9848fed80ad 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/JsiIntegrationTest.cpp @@ -348,21 +348,6 @@ TYPED_TEST(JsiIntegrationPortableTest, ExceptionDuringAddBindingIsIgnored) { EXPECT_TRUE(this->eval("globalThis.foo === 42").getBool()); } -TYPED_TEST(JsiIntegrationPortableTest, FuseboxSetClientMetadata) { - this->connect(); - - this->expectMessageFromPage(JsonEq(R"({ - "id": 1, - "result": {} - })")); - - this->toPage_->sendMessage(R"({ - "id": 1, - "method": "FuseboxClient.setClientMetadata", - "params": {} - })"); -} - TYPED_TEST(JsiIntegrationPortableTest, ReactNativeApplicationEnable) { this->connect();