diff --git a/front_end/core/protocol_client/InspectorBackend.ts b/front_end/core/protocol_client/InspectorBackend.ts index 8196ce792f1..54c5d6c9df7 100644 --- a/front_end/core/protocol_client/InspectorBackend.ts +++ b/front_end/core/protocol_client/InspectorBackend.ts @@ -672,10 +672,6 @@ export class TargetBase { return this.getAgent('Fetch'); } - fuseboxClientAgent(): ProtocolProxyApi.FuseboxClientApi { - return this.getAgent('FuseboxClient'); - } - heapProfilerAgent(): ProtocolProxyApi.HeapProfilerApi { return this.getAgent('HeapProfiler'); } diff --git a/front_end/core/sdk/ReactNativeApplicationModel.ts b/front_end/core/sdk/ReactNativeApplicationModel.ts index 38cab2997ba..c3b5121b5e6 100644 --- a/front_end/core/sdk/ReactNativeApplicationModel.ts +++ b/front_end/core/sdk/ReactNativeApplicationModel.ts @@ -6,6 +6,7 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js'; import type * as Protocol from '../../generated/protocol.js'; +import * as Host from '../../core/host/host.js'; import {Capability, type Target} from './Target.js'; import {SDKModel} from './SDKModel.js'; @@ -21,6 +22,9 @@ export class ReactNativeApplicationModel extends SDKModel implements this.#enabled = false; this.#agent = target.reactNativeApplicationAgent(); target.registerReactNativeApplicationDispatcher(this); + + // Auto-init. Paired with registering this model immediately in rn_fusebox.ts. + this.ensureEnabled(); } ensureEnabled(): void { @@ -28,7 +32,16 @@ export class ReactNativeApplicationModel extends SDKModel implements return; } - void this.#agent.invoke_enable(); + void this.#agent.invoke_enable() + .then(result => { + const maybeError = result.getError(); + const success = !maybeError; + Host.rnPerfMetrics.fuseboxSetClientMetadataFinished(success, maybeError); + }) + .catch(reason => { + const success = false; + Host.rnPerfMetrics.fuseboxSetClientMetadataFinished(success, reason); + }); this.#enabled = true; } @@ -45,11 +58,3 @@ export const enum Events { export type EventTypes = { [Events.MetadataUpdated]: Protocol.ReactNativeApplication.MetadataUpdatedEvent, }; - -SDKModel.register( - ReactNativeApplicationModel, - { - capabilities: Capability.None, - autostart: true, - }, -); diff --git a/front_end/entrypoints/rn_fusebox/rn_fusebox.ts b/front_end/entrypoints/rn_fusebox/rn_fusebox.ts index 68729990f53..fd864c6f06d 100644 --- a/front_end/entrypoints/rn_fusebox/rn_fusebox.ts +++ b/front_end/entrypoints/rn_fusebox/rn_fusebox.ts @@ -91,30 +91,12 @@ document.addEventListener('visibilitychange', () => { Host.rnPerfMetrics.browserVisibilityChanged(document.visibilityState); }); -class FuseboxClientMetadataModel extends SDK.SDKModel.SDKModel { - constructor(target: SDK.Target.Target) { - super(target); - Host.rnPerfMetrics.fuseboxSetClientMetadataStarted(); - target.fuseboxClientAgent() - .invoke_setClientMetadata() - .then(result => { - const maybeError = result.getError(); - const success = !maybeError; - Host.rnPerfMetrics.fuseboxSetClientMetadataFinished(success, maybeError); - }) - .catch(reason => { - const success = false; - Host.rnPerfMetrics.fuseboxSetClientMetadataFinished(success, reason); - }); - } -} - SDK.SDKModel.SDKModel.register( - FuseboxClientMetadataModel, + SDK.ReactNativeApplicationModel.ReactNativeApplicationModel, { capabilities: SDK.Target.Capability.None, autostart: true, - // Ensure FuseboxClient.setClientMetadata is sent before most other CDP domains + // Ensure ReactNativeApplication.enable is sent before most other CDP domains // are initialised. This allows the backend to confidently detect non-Fusebox // clients by the fact that they send e.g. Runtime.enable without sending any // Fusebox-specific messages first. diff --git a/front_end/generated/InspectorBackendCommands.js b/front_end/generated/InspectorBackendCommands.js index 1015bdfeced..d12afa04bb1 100644 --- a/front_end/generated/InspectorBackendCommands.js +++ b/front_end/generated/InspectorBackendCommands.js @@ -40,9 +40,6 @@ export let InspectorBackendAPI; export function registerCommands(inspectorBackend) { -// FuseboxClient. -inspectorBackend.registerCommand("FuseboxClient.setClientMetadata", [], [], "Identifies the current client as being Fusebox. The Fusebox backend may use this knowledge to print an informational message to the console, etc. The client should send this before enabling the Runtime and Log domains."); - // ReactNativeApplication. inspectorBackend.registerEvent("ReactNativeApplication.metadataUpdated", ["appDisplayName", "appIdentifier", "deviceName", "integrationName", "platform", "reactNativeVersion"]); inspectorBackend.registerCommand("ReactNativeApplication.disable", [], [], "Disables events from backend."); diff --git a/front_end/generated/protocol-mapping.d.ts b/front_end/generated/protocol-mapping.d.ts index 19243dac86e..42b1fb8a153 100644 --- a/front_end/generated/protocol-mapping.d.ts +++ b/front_end/generated/protocol-mapping.d.ts @@ -765,17 +765,6 @@ export namespace ProtocolMapping { } export interface Commands { - /** - * Identifies the current client as being Fusebox. - * - * The Fusebox backend may use this knowledge to print an informational - * message to the console, etc. The client should send this before enabling - * the Runtime and Log domains. - */ - 'FuseboxClient.setClientMetadata': { - paramsType: []; - returnType: void; - }; /** * Disables events from backend. */ diff --git a/front_end/generated/protocol-proxy-api.d.ts b/front_end/generated/protocol-proxy-api.d.ts index a4c8b2ce30e..4a79192884c 100644 --- a/front_end/generated/protocol-proxy-api.d.ts +++ b/front_end/generated/protocol-proxy-api.d.ts @@ -18,8 +18,6 @@ declare namespace ProtocolProxyApi { export type ProtocolDomainName = keyof ProtocolApi; export interface ProtocolApi { - FuseboxClient: FuseboxClientApi; - ReactNativeApplication: ReactNativeApplicationApi; Accessibility: AccessibilityApi; @@ -123,8 +121,6 @@ declare namespace ProtocolProxyApi { } export interface ProtocolDispatchers { - FuseboxClient: FuseboxClientDispatcher; - ReactNativeApplication: ReactNativeApplicationDispatcher; Accessibility: AccessibilityDispatcher; @@ -227,21 +223,6 @@ declare namespace ProtocolProxyApi { } - - export interface FuseboxClientApi { - /** - * Identifies the current client as being Fusebox. - * - * The Fusebox backend may use this knowledge to print an informational - * message to the console, etc. The client should send this before enabling - * the Runtime and Log domains. - */ - invoke_setClientMetadata(): Promise; - - } - export interface FuseboxClientDispatcher { - } - export interface ReactNativeApplicationApi { /** * Disables events from backend. diff --git a/front_end/generated/protocol.ts b/front_end/generated/protocol.ts index 1ae5157608b..341c311d55a 100644 --- a/front_end/generated/protocol.ts +++ b/front_end/generated/protocol.ts @@ -18,13 +18,6 @@ export interface ProtocolResponseWithError { type OpaqueType = {protocolOpaqueTypeTag: Tag}; type OpaqueIdentifier = RepresentationType&OpaqueType; -/** - * A React Native-specific domain pertaining to the Fusebox (React Native - * DevTools) client. - */ -export namespace FuseboxClient { -} - /** * A React Native-specific domain for interacting with React Native application * features. diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.json b/third_party/blink/public/devtools_protocol/browser_protocol.json index 12944b13af7..a2ce39648ce 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.json +++ b/third_party/blink/public/devtools_protocol/browser_protocol.json @@ -4,17 +4,6 @@ "minor": "3" }, "domains": [ - { - "domain": "FuseboxClient", - "description": "A React Native-specific domain pertaining to the Fusebox (React Native\nDevTools) client.", - "experimental": true, - "commands": [ - { - "name": "setClientMetadata", - "description": "Identifies the current client as being Fusebox.\n\nThe Fusebox backend may use this knowledge to print an informational\nmessage to the console, etc. The client should send this before enabling\nthe Runtime and Log domains." - } - ] - }, { "domain": "ReactNativeApplication", "description": "A React Native-specific domain for interacting with React Native application\nfeatures.", diff --git a/third_party/blink/public/devtools_protocol/react_native_domains.pdl b/third_party/blink/public/devtools_protocol/react_native_domains.pdl index 60ba84b1a90..834ad1fb6e8 100644 --- a/third_party/blink/public/devtools_protocol/react_native_domains.pdl +++ b/third_party/blink/public/devtools_protocol/react_native_domains.pdl @@ -1,16 +1,5 @@ # Copyright (c) Meta Platforms, Inc. and affiliates. -# A React Native-specific domain pertaining to the Fusebox (React Native -# DevTools) client. -experimental domain FuseboxClient - - # Identifies the current client as being Fusebox. - # - # The Fusebox backend may use this knowledge to print an informational - # message to the console, etc. The client should send this before enabling - # the Runtime and Log domains. - command setClientMetadata - # A React Native-specific domain for interacting with React Native application # features. experimental domain ReactNativeApplication