browser_protocol/domdebugger/
mod.rs1use serde::{Serialize, Deserialize};
4use serde_json::Value as JsonValue;
5
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
9pub enum DOMBreakpointType {
10 #[default]
11 SubtreeModified,
12 AttributeModified,
13 NodeRemoved,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
19pub enum CSPViolationType {
20 #[default]
21 TrustedtypeSinkViolation,
22 TrustedtypePolicyViolation,
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize, Default)]
28#[serde(rename_all = "camelCase")]
29pub struct EventListener {
30 #[serde(rename = "type")]
33 pub type_: String,
34 pub useCapture: bool,
37 pub passive: bool,
40 pub once: bool,
43 pub scriptId: crate::runtime::ScriptId,
46 pub lineNumber: i64,
49 pub columnNumber: i64,
52 #[serde(skip_serializing_if = "Option::is_none")]
55 pub handler: Option<crate::runtime::RemoteObject>,
56 #[serde(skip_serializing_if = "Option::is_none")]
59 pub originalHandler: Option<crate::runtime::RemoteObject>,
60 #[serde(skip_serializing_if = "Option::is_none")]
63 pub backendNodeId: Option<crate::dom::BackendNodeId>,
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize, Default)]
69#[serde(rename_all = "camelCase")]
70pub struct GetEventListenersParams {
71 pub objectId: crate::runtime::RemoteObjectId,
74 #[serde(skip_serializing_if = "Option::is_none")]
78 pub depth: Option<i64>,
79 #[serde(skip_serializing_if = "Option::is_none")]
83 pub pierce: Option<bool>,
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize, Default)]
89#[serde(rename_all = "camelCase")]
90pub struct GetEventListenersReturns {
91 pub listeners: Vec<EventListener>,
94}
95
96impl GetEventListenersParams { pub const METHOD: &'static str = "DOMDebugger.getEventListeners"; }
97
98impl crate::CdpCommand for GetEventListenersParams {
99 const METHOD: &'static str = "DOMDebugger.getEventListeners";
100 type Response = GetEventListenersReturns;
101}
102
103#[derive(Debug, Clone, Serialize, Deserialize, Default)]
106#[serde(rename_all = "camelCase")]
107pub struct RemoveDOMBreakpointParams {
108 pub nodeId: crate::dom::NodeId,
111 #[serde(rename = "type")]
114 pub type_: DOMBreakpointType,
115}
116
117impl RemoveDOMBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeDOMBreakpoint"; }
118
119impl crate::CdpCommand for RemoveDOMBreakpointParams {
120 const METHOD: &'static str = "DOMDebugger.removeDOMBreakpoint";
121 type Response = crate::EmptyReturns;
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize, Default)]
127#[serde(rename_all = "camelCase")]
128pub struct RemoveEventListenerBreakpointParams {
129 pub eventName: String,
132 #[serde(skip_serializing_if = "Option::is_none")]
135 pub targetName: Option<String>,
136}
137
138impl RemoveEventListenerBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeEventListenerBreakpoint"; }
139
140impl crate::CdpCommand for RemoveEventListenerBreakpointParams {
141 const METHOD: &'static str = "DOMDebugger.removeEventListenerBreakpoint";
142 type Response = crate::EmptyReturns;
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize, Default)]
148#[serde(rename_all = "camelCase")]
149pub struct RemoveInstrumentationBreakpointParams {
150 pub eventName: String,
153}
154
155impl RemoveInstrumentationBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeInstrumentationBreakpoint"; }
156
157impl crate::CdpCommand for RemoveInstrumentationBreakpointParams {
158 const METHOD: &'static str = "DOMDebugger.removeInstrumentationBreakpoint";
159 type Response = crate::EmptyReturns;
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize, Default)]
165#[serde(rename_all = "camelCase")]
166pub struct RemoveXHRBreakpointParams {
167 pub url: String,
170}
171
172impl RemoveXHRBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeXHRBreakpoint"; }
173
174impl crate::CdpCommand for RemoveXHRBreakpointParams {
175 const METHOD: &'static str = "DOMDebugger.removeXHRBreakpoint";
176 type Response = crate::EmptyReturns;
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize, Default)]
182#[serde(rename_all = "camelCase")]
183pub struct SetBreakOnCSPViolationParams {
184 pub violationTypes: Vec<CSPViolationType>,
187}
188
189impl SetBreakOnCSPViolationParams { pub const METHOD: &'static str = "DOMDebugger.setBreakOnCSPViolation"; }
190
191impl crate::CdpCommand for SetBreakOnCSPViolationParams {
192 const METHOD: &'static str = "DOMDebugger.setBreakOnCSPViolation";
193 type Response = crate::EmptyReturns;
194}
195
196#[derive(Debug, Clone, Serialize, Deserialize, Default)]
199#[serde(rename_all = "camelCase")]
200pub struct SetDOMBreakpointParams {
201 pub nodeId: crate::dom::NodeId,
204 #[serde(rename = "type")]
207 pub type_: DOMBreakpointType,
208}
209
210impl SetDOMBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setDOMBreakpoint"; }
211
212impl crate::CdpCommand for SetDOMBreakpointParams {
213 const METHOD: &'static str = "DOMDebugger.setDOMBreakpoint";
214 type Response = crate::EmptyReturns;
215}
216
217#[derive(Debug, Clone, Serialize, Deserialize, Default)]
220#[serde(rename_all = "camelCase")]
221pub struct SetEventListenerBreakpointParams {
222 pub eventName: String,
225 #[serde(skip_serializing_if = "Option::is_none")]
229 pub targetName: Option<String>,
230}
231
232impl SetEventListenerBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setEventListenerBreakpoint"; }
233
234impl crate::CdpCommand for SetEventListenerBreakpointParams {
235 const METHOD: &'static str = "DOMDebugger.setEventListenerBreakpoint";
236 type Response = crate::EmptyReturns;
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize, Default)]
242#[serde(rename_all = "camelCase")]
243pub struct SetInstrumentationBreakpointParams {
244 pub eventName: String,
247}
248
249impl SetInstrumentationBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setInstrumentationBreakpoint"; }
250
251impl crate::CdpCommand for SetInstrumentationBreakpointParams {
252 const METHOD: &'static str = "DOMDebugger.setInstrumentationBreakpoint";
253 type Response = crate::EmptyReturns;
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize, Default)]
259#[serde(rename_all = "camelCase")]
260pub struct SetXHRBreakpointParams {
261 pub url: String,
264}
265
266impl SetXHRBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setXHRBreakpoint"; }
267
268impl crate::CdpCommand for SetXHRBreakpointParams {
269 const METHOD: &'static str = "DOMDebugger.setXHRBreakpoint";
270 type Response = crate::EmptyReturns;
271}