Skip to content

Commit

Permalink
Remove FuseboxClient CDP domain
Browse files Browse the repository at this point in the history
Summary:
Follows facebook#47962 and depends on facebook/react-native-devtools-frontend#139.

Updates the modern debugger server to no longer respond to `FuseboxClient` messages — namely `FuseboxClient.setClientMetadata`. This method was previously used to identify the React Native DevTools frontend, replaced/inferred by `ReactNativeApplication.enable` instead.

Changelog:
[General][Breaking] - The `FuseboxClient.setClientMetadata` CDP method is removed. Instead, use `ReactNativeApplication.enable`.

Differential Revision: D66575324
  • Loading branch information
huntie authored and facebook-github-bot committed Nov 28, 2024
1 parent d0c3c08 commit cef1913
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 30 deletions.
14 changes: 0 additions & 14 deletions packages/react-native/ReactCommon/jsinspector-modern/HostAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ class HostAgent final {
const HostTargetMetadata hostMetadata_;
std::shared_ptr<InstanceAgent> instanceAgent_;
FuseboxClientType fuseboxClientType_{FuseboxClientType::Unknown};
bool fuseboxNoticeLogged_{false};
bool isPausedInDebuggerOverlayVisible_{false};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit cef1913

Please sign in to comment.