From 0acf6f6a7525cd185d52812694cbc1ff301694af Mon Sep 17 00:00:00 2001 From: Chengzhong Wu Date: Sun, 26 Oct 2025 19:45:50 +0000 Subject: [PATCH] src: split inspector protocol domains files This splits inspector protocol domains into their own dedicated pdl files. --- src/inspector/domain_io.pdl | 24 ++ src/inspector/domain_network.pdl | 228 +++++++++++++++ src/inspector/domain_node_runtime.pdl | 22 ++ src/inspector/domain_node_tracing.pdl | 34 +++ src/inspector/domain_node_worker.pdl | 59 ++++ src/inspector/domain_target.pdl | 26 ++ src/inspector/node_inspector.gypi | 17 +- src/inspector/node_protocol.pdl | 397 +------------------------- 8 files changed, 412 insertions(+), 395 deletions(-) create mode 100644 src/inspector/domain_io.pdl create mode 100644 src/inspector/domain_network.pdl create mode 100644 src/inspector/domain_node_runtime.pdl create mode 100644 src/inspector/domain_node_tracing.pdl create mode 100644 src/inspector/domain_node_worker.pdl create mode 100644 src/inspector/domain_target.pdl diff --git a/src/inspector/domain_io.pdl b/src/inspector/domain_io.pdl new file mode 100644 index 00000000000000..2500db1c43a91f --- /dev/null +++ b/src/inspector/domain_io.pdl @@ -0,0 +1,24 @@ +# Partial support for IO domain of ChromeDevTools Protocol. +# https://github.com/ChromeDevTools/devtools-protocol/blob/master/pdl/domains/IO.pdl + +domain IO + type StreamHandle extends string + # Read a chunk of the stream + command read + parameters + # Handle of the stream to read. + StreamHandle handle + # Seek to the specified offset before reading (if not specified, proceed with offset + # following the last read). Some types of streams may only support sequential reads. + optional integer offset + # Maximum number of bytes to read (left upon the agent discretion if not specified). + optional integer size + returns + # Data that were read. + string data + # Set if the end-of-file condition occurred while reading. + boolean eof + command close + parameters + # Handle of the stream to close. + StreamHandle handle diff --git a/src/inspector/domain_network.pdl b/src/inspector/domain_network.pdl new file mode 100644 index 00000000000000..fdfd9ebe1fdeb4 --- /dev/null +++ b/src/inspector/domain_network.pdl @@ -0,0 +1,228 @@ +# Partial support for Network domain of ChromeDevTools Protocol. +# https://github.com/ChromeDevTools/devtools-protocol/blob/master/pdl/domains/Network.pdl + +experimental domain Network + depends on Runtime + + # Resource type as it was perceived by the rendering engine. + type ResourceType extends string + enum + Document + Stylesheet + Image + Media + Font + Script + TextTrack + XHR + Fetch + Prefetch + EventSource + WebSocket + Manifest + SignedExchange + Ping + CSPViolationReport + Preflight + Other + + # Unique request identifier. + type RequestId extends string + + # UTC time in seconds, counted from January 1, 1970. + type TimeSinceEpoch extends number + + # Monotonically increasing time in seconds since an arbitrary point in the past. + type MonotonicTime extends number + + # Information about the request initiator. + type Initiator extends object + properties + # Type of this initiator. + enum type + parser + script + preload + SignedExchange + preflight + other + # Initiator JavaScript stack trace, set for Script only. + # Requires the Debugger domain to be enabled. + optional Runtime.StackTrace stack + # Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. + optional string url + # Initiator line number, set for Parser type or for Script type (when script is importing + # module) (0-based). + optional number lineNumber + # Initiator column number, set for Parser type or for Script type (when script is importing + # module) (0-based). + optional number columnNumber + # Set if another request triggered this request (e.g. preflight). + optional RequestId requestId + + # HTTP request data. + type Request extends object + properties + string url + string method + Headers headers + boolean hasPostData + + # HTTP response data. + type Response extends object + properties + string url + integer status + string statusText + Headers headers + string mimeType + string charset + + # Request / response headers as keys / values of JSON object. + type Headers extends object + + type LoadNetworkResourcePageResult extends object + properties + boolean success + optional IO.StreamHandle stream + + # WebSocket response data. + type WebSocketResponse extends object + properties + # HTTP response status code. + integer status + # HTTP response status text. + string statusText + # HTTP response headers. + Headers headers + + # Disables network tracking, prevents network events from being sent to the client. + command disable + + # Enables network tracking, network events will now be delivered to the client. + command enable + parameters + # Buffer size in bytes to use when preserving network payloads (XHRs, etc). + experimental optional integer maxTotalBufferSize + # Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). + experimental optional integer maxResourceBufferSize + + # Returns post data sent with the request. Returns an error when no data was sent with the request. + command getRequestPostData + parameters + # Identifier of the network request to get content for. + RequestId requestId + returns + # Request body string, omitting files from multipart requests + string postData + + # Returns content served for the given request. + command getResponseBody + parameters + # Identifier of the network request to get content for. + RequestId requestId + returns + # Response body. + string body + # True, if content was sent as base64. + boolean base64Encoded + + # Enables streaming of the response for the given requestId. + # If enabled, the dataReceived event contains the data that was received during streaming. + experimental command streamResourceContent + parameters + # Identifier of the request to stream. + RequestId requestId + returns + # Data that has been buffered until streaming is enabled. + binary bufferedData + # Fetches the resource and returns the content. + command loadNetworkResource + parameters + # URL of the resource to get content for. + string url + returns + LoadNetworkResourcePageResult resource + + # Fired when page is about to send HTTP request. + event requestWillBeSent + parameters + # Request identifier. + RequestId requestId + # Request data. + Request request + # Request initiator. + Initiator initiator + # Timestamp. + MonotonicTime timestamp + # Timestamp. + TimeSinceEpoch wallTime + + # Fired when HTTP response is available. + event responseReceived + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + # Resource type. + ResourceType type + # Response data. + Response response + + event loadingFailed + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + # Resource type. + ResourceType type + # Error message. + string errorText + + event loadingFinished + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + + # Fired when data chunk was received over the network. + event dataReceived + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + # Data chunk length. + integer dataLength + # Actual bytes received (might be less than dataLength for compressed encodings). + integer encodedDataLength + # Data that was received. + experimental optional binary data + # Fired upon WebSocket creation. + event webSocketCreated + parameters + # Request identifier. + RequestId requestId + # WebSocket request URL. + string url + # Request initiator. + Initiator initiator + # Fired when WebSocket is closed. + event webSocketClosed + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + # Fired when WebSocket handshake response becomes available. + event webSocketHandshakeResponseReceived + parameters + # Request identifier. + RequestId requestId + # Timestamp. + MonotonicTime timestamp + # WebSocket response data. + WebSocketResponse response diff --git a/src/inspector/domain_node_runtime.pdl b/src/inspector/domain_node_runtime.pdl new file mode 100644 index 00000000000000..6d3e812a643020 --- /dev/null +++ b/src/inspector/domain_node_runtime.pdl @@ -0,0 +1,22 @@ +# Support for inspecting node process state. +experimental domain NodeRuntime + # Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. + command enable + + # Disable NodeRuntime events + command disable + + # Enable the `NodeRuntime.waitingForDisconnect`. + command notifyWhenWaitingForDisconnect + parameters + boolean enabled + + # This event is fired instead of `Runtime.executionContextDestroyed` when + # enabled. + # It is fired when the Node process finished all code execution and is + # waiting for all frontends to disconnect. + event waitingForDisconnect + + # This event is fired when the runtime is waiting for the debugger. For + # example, when inspector.waitingForDebugger is called + event waitingForDebugger diff --git a/src/inspector/domain_node_tracing.pdl b/src/inspector/domain_node_tracing.pdl new file mode 100644 index 00000000000000..3da8514b671436 --- /dev/null +++ b/src/inspector/domain_node_tracing.pdl @@ -0,0 +1,34 @@ +experimental domain NodeTracing + type TraceConfig extends object + properties + # Controls how the trace buffer stores data. + optional enum recordMode + recordUntilFull + recordContinuously + recordAsMuchAsPossible + # Included category filters. + array of string includedCategories + + # Gets supported tracing categories. + command getCategories + returns + # A list of supported tracing categories. + array of string categories + + # Start trace events collection. + command start + parameters + TraceConfig traceConfig + + # Stop trace events collection. Remaining collected events will be sent as a sequence of + # dataCollected events followed by tracingComplete event. + command stop + + # Contains an bucket of collected trace events. + event dataCollected + parameters + array of object value + + # Signals that tracing is stopped and there is no trace buffers pending flush, all data were + # delivered via dataCollected events. + event tracingComplete diff --git a/src/inspector/domain_node_worker.pdl b/src/inspector/domain_node_worker.pdl new file mode 100644 index 00000000000000..785ed714a1afce --- /dev/null +++ b/src/inspector/domain_node_worker.pdl @@ -0,0 +1,59 @@ +# Support for sending messages to Node worker Inspector instances. +experimental domain NodeWorker + + type WorkerID extends string + + # Unique identifier of attached debugging session. + type SessionID extends string + + type WorkerInfo extends object + properties + WorkerID workerId + string type + string title + string url + + # Sends protocol message over session with given id. + command sendMessageToWorker + parameters + string message + # Identifier of the session. + SessionID sessionId + + # Instructs the inspector to attach to running workers. Will also attach to new workers + # as they start + command enable + parameters + # Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` + # message to run them. + boolean waitForDebuggerOnStart + + # Detaches from all running workers and disables attaching to new workers as they are started. + command disable + + # Detached from the worker with given sessionId. + command detach + parameters + SessionID sessionId + + # Issued when attached to a worker. + event attachedToWorker + parameters + # Identifier assigned to the session used to send/receive messages. + SessionID sessionId + WorkerInfo workerInfo + boolean waitingForDebugger + + # Issued when detached from the worker. + event detachedFromWorker + parameters + # Detached session identifier. + SessionID sessionId + + # Notifies about a new protocol message received from the session + # (session ID is provided in attachedToWorker notification). + event receivedMessageFromWorker + parameters + # Identifier of a session which sends a message. + SessionID sessionId + string message diff --git a/src/inspector/domain_target.pdl b/src/inspector/domain_target.pdl new file mode 100644 index 00000000000000..3195b3a441d8ab --- /dev/null +++ b/src/inspector/domain_target.pdl @@ -0,0 +1,26 @@ +# Partial support for IO domain of ChromeDevTools Protocol. +# https://github.com/ChromeDevTools/devtools-protocol/blob/master/pdl/domains/Target.pdl + +experimental domain Target + type SessionID extends string + type TargetID extends string + type TargetInfo extends object + properties + TargetID targetId + string type + string title + string url + boolean attached + boolean canAccessOpener + event targetCreated + parameters + TargetInfo targetInfo + event attachedToTarget + parameters + SessionID sessionId + TargetInfo targetInfo + boolean waitingForDebugger + command setAutoAttach + parameters + boolean autoAttach + boolean waitForDebuggerOnStart diff --git a/src/inspector/node_inspector.gypi b/src/inspector/node_inspector.gypi index ad81f837e84d76..cde02a28d03dfa 100644 --- a/src/inspector/node_inspector.gypi +++ b/src/inspector/node_inspector.gypi @@ -71,7 +71,16 @@ '<(protocol_tool_path)/templates/Imported_h.template', '<(protocol_tool_path)/templates/TypeBuilder_cpp.template', '<(protocol_tool_path)/templates/TypeBuilder_h.template', - ] + ], + 'node_pdl_files': [ + 'node_protocol.pdl', + 'domain_io.pdl', + 'domain_network.pdl', + 'domain_node_runtime.pdl', + 'domain_node_tracing.pdl', + 'domain_node_worker.pdl', + 'domain_target.pdl', + ], }, 'defines': [ 'HAVE_INSPECTOR=1', @@ -92,7 +101,7 @@ { 'action_name': 'convert_node_protocol_to_json', 'inputs': [ - 'node_protocol.pdl', + '<@(node_pdl_files)', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/src/node_protocol.json', @@ -100,7 +109,7 @@ 'action': [ '<(python)', '<(protocol_tool_path)/convert_protocol_to_json.py', - '<@(_inputs)', + 'src/inspector/node_protocol.pdl', '<@(_outputs)', ], }, @@ -108,7 +117,7 @@ 'action_name': 'node_protocol_generated_sources', 'inputs': [ 'node_protocol_config.json', - 'node_protocol.pdl', + '<@(node_pdl_files)', '<(SHARED_INTERMEDIATE_DIR)/src/node_protocol.json', '<@(node_protocol_files)', '<(protocol_tool_path)/code_generator.py', diff --git a/src/inspector/node_protocol.pdl b/src/inspector/node_protocol.pdl index 24cff73585aeb7..87b3d93d39c245 100644 --- a/src/inspector/node_protocol.pdl +++ b/src/inspector/node_protocol.pdl @@ -3,394 +3,9 @@ version major 1 minor 0 -experimental domain NodeTracing - type TraceConfig extends object - properties - # Controls how the trace buffer stores data. - optional enum recordMode - recordUntilFull - recordContinuously - recordAsMuchAsPossible - # Included category filters. - array of string includedCategories - - # Gets supported tracing categories. - command getCategories - returns - # A list of supported tracing categories. - array of string categories - - # Start trace events collection. - command start - parameters - TraceConfig traceConfig - - # Stop trace events collection. Remaining collected events will be sent as a sequence of - # dataCollected events followed by tracingComplete event. - command stop - - # Contains an bucket of collected trace events. - event dataCollected - parameters - array of object value - - # Signals that tracing is stopped and there is no trace buffers pending flush, all data were - # delivered via dataCollected events. - event tracingComplete - -# Support for sending messages to Node worker Inspector instances. -experimental domain NodeWorker - - type WorkerID extends string - - # Unique identifier of attached debugging session. - type SessionID extends string - - type WorkerInfo extends object - properties - WorkerID workerId - string type - string title - string url - - # Sends protocol message over session with given id. - command sendMessageToWorker - parameters - string message - # Identifier of the session. - SessionID sessionId - - # Instructs the inspector to attach to running workers. Will also attach to new workers - # as they start - command enable - parameters - # Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - # message to run them. - boolean waitForDebuggerOnStart - - # Detaches from all running workers and disables attaching to new workers as they are started. - command disable - - # Detached from the worker with given sessionId. - command detach - parameters - SessionID sessionId - - # Issued when attached to a worker. - event attachedToWorker - parameters - # Identifier assigned to the session used to send/receive messages. - SessionID sessionId - WorkerInfo workerInfo - boolean waitingForDebugger - - # Issued when detached from the worker. - event detachedFromWorker - parameters - # Detached session identifier. - SessionID sessionId - - # Notifies about a new protocol message received from the session - # (session ID is provided in attachedToWorker notification). - event receivedMessageFromWorker - parameters - # Identifier of a session which sends a message. - SessionID sessionId - string message - -# Partial support for Network domain of ChromeDevTools Protocol. -# https://chromedevtools.github.io/devtools-protocol/tot/Network -experimental domain Network - depends on Runtime - - # Resource type as it was perceived by the rendering engine. - type ResourceType extends string - enum - Document - Stylesheet - Image - Media - Font - Script - TextTrack - XHR - Fetch - Prefetch - EventSource - WebSocket - Manifest - SignedExchange - Ping - CSPViolationReport - Preflight - Other - - # Unique request identifier. - type RequestId extends string - - # UTC time in seconds, counted from January 1, 1970. - type TimeSinceEpoch extends number - - # Monotonically increasing time in seconds since an arbitrary point in the past. - type MonotonicTime extends number - - # Information about the request initiator. - type Initiator extends object - properties - # Type of this initiator. - enum type - parser - script - preload - SignedExchange - preflight - other - # Initiator JavaScript stack trace, set for Script only. - # Requires the Debugger domain to be enabled. - optional Runtime.StackTrace stack - # Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. - optional string url - # Initiator line number, set for Parser type or for Script type (when script is importing - # module) (0-based). - optional number lineNumber - # Initiator column number, set for Parser type or for Script type (when script is importing - # module) (0-based). - optional number columnNumber - # Set if another request triggered this request (e.g. preflight). - optional RequestId requestId - - # HTTP request data. - type Request extends object - properties - string url - string method - Headers headers - boolean hasPostData - - # HTTP response data. - type Response extends object - properties - string url - integer status - string statusText - Headers headers - string mimeType - string charset - - # Request / response headers as keys / values of JSON object. - type Headers extends object - - type LoadNetworkResourcePageResult extends object - properties - boolean success - optional IO.StreamHandle stream - - # WebSocket response data. - type WebSocketResponse extends object - properties - # HTTP response status code. - integer status - # HTTP response status text. - string statusText - # HTTP response headers. - Headers headers - - # Disables network tracking, prevents network events from being sent to the client. - command disable - - # Enables network tracking, network events will now be delivered to the client. - command enable - parameters - # Buffer size in bytes to use when preserving network payloads (XHRs, etc). - experimental optional integer maxTotalBufferSize - # Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). - experimental optional integer maxResourceBufferSize - - # Returns post data sent with the request. Returns an error when no data was sent with the request. - command getRequestPostData - parameters - # Identifier of the network request to get content for. - RequestId requestId - returns - # Request body string, omitting files from multipart requests - string postData - - # Returns content served for the given request. - command getResponseBody - parameters - # Identifier of the network request to get content for. - RequestId requestId - returns - # Response body. - string body - # True, if content was sent as base64. - boolean base64Encoded - - # Enables streaming of the response for the given requestId. - # If enabled, the dataReceived event contains the data that was received during streaming. - experimental command streamResourceContent - parameters - # Identifier of the request to stream. - RequestId requestId - returns - # Data that has been buffered until streaming is enabled. - binary bufferedData - # Fetches the resource and returns the content. - command loadNetworkResource - parameters - # URL of the resource to get content for. - string url - returns - LoadNetworkResourcePageResult resource - - # Fired when page is about to send HTTP request. - event requestWillBeSent - parameters - # Request identifier. - RequestId requestId - # Request data. - Request request - # Request initiator. - Initiator initiator - # Timestamp. - MonotonicTime timestamp - # Timestamp. - TimeSinceEpoch wallTime - - # Fired when HTTP response is available. - event responseReceived - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - # Resource type. - ResourceType type - # Response data. - Response response - - event loadingFailed - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - # Resource type. - ResourceType type - # Error message. - string errorText - - event loadingFinished - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - - # Fired when data chunk was received over the network. - event dataReceived - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - # Data chunk length. - integer dataLength - # Actual bytes received (might be less than dataLength for compressed encodings). - integer encodedDataLength - # Data that was received. - experimental optional binary data - # Fired upon WebSocket creation. - event webSocketCreated - parameters - # Request identifier. - RequestId requestId - # WebSocket request URL. - string url - # Request initiator. - Initiator initiator - # Fired when WebSocket is closed. - event webSocketClosed - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - # Fired when WebSocket handshake response becomes available. - event webSocketHandshakeResponseReceived - parameters - # Request identifier. - RequestId requestId - # Timestamp. - MonotonicTime timestamp - # WebSocket response data. - WebSocketResponse response - -# Support for inspecting node process state. -experimental domain NodeRuntime - # Enable the NodeRuntime events except by `NodeRuntime.waitingForDisconnect`. - command enable - - # Disable NodeRuntime events - command disable - - # Enable the `NodeRuntime.waitingForDisconnect`. - command notifyWhenWaitingForDisconnect - parameters - boolean enabled - - # This event is fired instead of `Runtime.executionContextDestroyed` when - # enabled. - # It is fired when the Node process finished all code execution and is - # waiting for all frontends to disconnect. - event waitingForDisconnect - - # This event is fired when the runtime is waiting for the debugger. For - # example, when inspector.waitingForDebugger is called - event waitingForDebugger - -# https://chromedevtools.github.io/devtools-protocol/1-3/Target/ -experimental domain Target - type SessionID extends string - type TargetID extends string - type TargetInfo extends object - properties - TargetID targetId - string type - string title - string url - boolean attached - boolean canAccessOpener - event targetCreated - parameters - TargetInfo targetInfo - event attachedToTarget - parameters - SessionID sessionId - TargetInfo targetInfo - boolean waitingForDebugger - command setAutoAttach - parameters - boolean autoAttach - boolean waitForDebuggerOnStart -domain IO - type StreamHandle extends string - # Read a chunk of the stream - command read - parameters - # Handle of the stream to read. - StreamHandle handle - # Seek to the specified offset before reading (if not specified, proceed with offset - # following the last read). Some types of streams may only support sequential reads. - optional integer offset - # Maximum number of bytes to read (left upon the agent discretion if not specified). - optional integer size - returns - # Data that were read. - string data - # Set if the end-of-file condition occurred while reading. - boolean eof - command close - parameters - # Handle of the stream to close. - StreamHandle handle +include domain_io.pdl +include domain_network.pdl +include domain_node_runtime.pdl +include domain_node_tracing.pdl +include domain_node_worker.pdl +include domain_target.pdl