diff --git a/front_end/core/protocol_client/InspectorBackend.ts b/front_end/core/protocol_client/InspectorBackend.ts index 4c8926d6ac1..e23b57fef0a 100644 --- a/front_end/core/protocol_client/InspectorBackend.ts +++ b/front_end/core/protocol_client/InspectorBackend.ts @@ -736,6 +736,10 @@ export class TargetBase { return this.getAgent('Performance'); } + reactNativeApplicationAgent(): ProtocolProxyApi.ReactNativeApplicationApi { + return this.getAgent('ReactNativeApplication'); + } + runtimeAgent(): ProtocolProxyApi.RuntimeApi { return this.getAgent('Runtime'); } diff --git a/front_end/generated/InspectorBackendCommands.js b/front_end/generated/InspectorBackendCommands.js index ce43d66ec18..1015bdfeced 100644 --- a/front_end/generated/InspectorBackendCommands.js +++ b/front_end/generated/InspectorBackendCommands.js @@ -43,6 +43,11 @@ 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."); +inspectorBackend.registerCommand("ReactNativeApplication.enable", [], [], "Enables events from backend."); + // Accessibility. inspectorBackend.registerEnum("Accessibility.AXValueType", {Boolean: "boolean", Tristate: "tristate", BooleanOrUndefined: "booleanOrUndefined", Idref: "idref", IdrefList: "idrefList", Integer: "integer", Node: "node", NodeList: "nodeList", Number: "number", String: "string", ComputedString: "computedString", Token: "token", TokenList: "tokenList", DomRelation: "domRelation", Role: "role", InternalRole: "internalRole", ValueUndefined: "valueUndefined"}); inspectorBackend.registerEnum("Accessibility.AXValueSourceType", {Attribute: "attribute", Implicit: "implicit", Style: "style", Contents: "contents", Placeholder: "placeholder", RelatedElement: "relatedElement"}); diff --git a/front_end/generated/protocol-mapping.d.ts b/front_end/generated/protocol-mapping.d.ts index 2f53b6f212f..19243dac86e 100644 --- a/front_end/generated/protocol-mapping.d.ts +++ b/front_end/generated/protocol-mapping.d.ts @@ -12,6 +12,11 @@ */ export namespace ProtocolMapping { export interface Events { + /** + * Issued once after the domain is enabled. Contains metadata about the + * device, application, and debugger integration. + */ + 'ReactNativeApplication.metadataUpdated': [Protocol.ReactNativeApplication.MetadataUpdatedEvent]; /** * The loadComplete event mirrors the load complete event sent by the browser to assistive * technology when the web page has finished loading. @@ -771,6 +776,20 @@ export namespace ProtocolMapping { paramsType: []; returnType: void; }; + /** + * Disables events from backend. + */ + 'ReactNativeApplication.disable': { + paramsType: []; + returnType: void; + }; + /** + * Enables events from backend. + */ + 'ReactNativeApplication.enable': { + paramsType: []; + returnType: void; + }; /** * Disables the accessibility domain. */ diff --git a/front_end/generated/protocol-proxy-api.d.ts b/front_end/generated/protocol-proxy-api.d.ts index 671589f35ff..a4c8b2ce30e 100644 --- a/front_end/generated/protocol-proxy-api.d.ts +++ b/front_end/generated/protocol-proxy-api.d.ts @@ -20,6 +20,8 @@ declare namespace ProtocolProxyApi { export interface ProtocolApi { FuseboxClient: FuseboxClientApi; + ReactNativeApplication: ReactNativeApplicationApi; + Accessibility: AccessibilityApi; Animation: AnimationApi; @@ -123,6 +125,8 @@ declare namespace ProtocolProxyApi { export interface ProtocolDispatchers { FuseboxClient: FuseboxClientDispatcher; + ReactNativeApplication: ReactNativeApplicationDispatcher; + Accessibility: AccessibilityDispatcher; Animation: AnimationDispatcher; @@ -238,6 +242,27 @@ declare namespace ProtocolProxyApi { export interface FuseboxClientDispatcher { } + export interface ReactNativeApplicationApi { + /** + * Disables events from backend. + */ + invoke_disable(): Promise; + + /** + * Enables events from backend. + */ + invoke_enable(): Promise; + + } + export interface ReactNativeApplicationDispatcher { + /** + * Issued once after the domain is enabled. Contains metadata about the + * device, application, and debugger integration. + */ + metadataUpdated(params: Protocol.ReactNativeApplication.MetadataUpdatedEvent): void; + + } + export interface AccessibilityApi { /** * Disables the accessibility domain. diff --git a/front_end/generated/protocol.ts b/front_end/generated/protocol.ts index 8e0e1e17a23..1ae5157608b 100644 --- a/front_end/generated/protocol.ts +++ b/front_end/generated/protocol.ts @@ -25,6 +25,44 @@ type OpaqueIdentifier = RepresentationTy export namespace FuseboxClient { } +/** + * A React Native-specific domain for interacting with React Native application + * features. + */ +export namespace ReactNativeApplication { + + /** + * Issued once after the domain is enabled. Contains metadata about the + * device, application, and debugger integration. + */ + export interface MetadataUpdatedEvent { + /** + * The app display name. + */ + appDisplayName?: string; + /** + * The app bundle identifier. + */ + appIdentifier?: string; + /** + * The device name. + */ + deviceName?: string; + /** + * A label identifying the debugger integration. + */ + integrationName: string; + /** + * The platform name. + */ + platform?: string; + /** + * The React Native version. + */ + reactNativeVersion?: string; + } +} + export namespace Accessibility { /** diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.json b/third_party/blink/public/devtools_protocol/browser_protocol.json index 3aa3457039a..12944b13af7 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.json +++ b/third_party/blink/public/devtools_protocol/browser_protocol.json @@ -15,6 +15,64 @@ } ] }, + { + "domain": "ReactNativeApplication", + "description": "A React Native-specific domain for interacting with React Native application\nfeatures.", + "experimental": true, + "commands": [ + { + "name": "disable", + "description": "Disables events from backend." + }, + { + "name": "enable", + "description": "Enables events from backend." + } + ], + "events": [ + { + "name": "metadataUpdated", + "description": "Issued once after the domain is enabled. Contains metadata about the\ndevice, application, and debugger integration.", + "parameters": [ + { + "name": "appDisplayName", + "description": "The app display name.", + "optional": true, + "type": "string" + }, + { + "name": "appIdentifier", + "description": "The app bundle identifier.", + "optional": true, + "type": "string" + }, + { + "name": "deviceName", + "description": "The device name.", + "optional": true, + "type": "string" + }, + { + "name": "integrationName", + "description": "A label identifying the debugger integration.", + "type": "string" + }, + { + "name": "platform", + "description": "The platform name.", + "optional": true, + "type": "string" + }, + { + "name": "reactNativeVersion", + "description": "The React Native version.", + "optional": true, + "type": "string" + } + ] + } + ] + }, { "domain": "Accessibility", "experimental": true, 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 b7af5cf1202..60ba84b1a90 100644 --- a/third_party/blink/public/devtools_protocol/react_native_domains.pdl +++ b/third_party/blink/public/devtools_protocol/react_native_domains.pdl @@ -10,3 +10,30 @@ experimental domain FuseboxClient # 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 + + # Disables events from backend. + command disable + + # Enables events from backend. + command enable + + # Issued once after the domain is enabled. Contains metadata about the + # device, application, and debugger integration. + event metadataUpdated + parameters + # The app display name. + optional string appDisplayName + # The app bundle identifier. + optional string appIdentifier + # The device name. + optional string deviceName + # A label identifying the debugger integration. + string integrationName + # The platform name. + optional string platform + # The React Native version. + optional string reactNativeVersion