use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum DOMBreakpointType {
#[default]
SubtreeModified,
AttributeModified,
NodeRemoved,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum CSPViolationType {
#[default]
TrustedtypeSinkViolation,
TrustedtypePolicyViolation,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EventListener {
#[serde(rename = "type")]
pub type_: String,
pub useCapture: bool,
pub passive: bool,
pub once: bool,
pub scriptId: crate::runtime::ScriptId,
pub lineNumber: i64,
pub columnNumber: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub handler: Option<crate::runtime::RemoteObject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub originalHandler: Option<crate::runtime::RemoteObject>,
#[serde(skip_serializing_if = "Option::is_none")]
pub backendNodeId: Option<crate::dom::BackendNodeId>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetEventListenersParams {
pub objectId: crate::runtime::RemoteObjectId,
#[serde(skip_serializing_if = "Option::is_none")]
pub depth: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pierce: Option<bool>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetEventListenersReturns {
pub listeners: Vec<EventListener>,
}
impl GetEventListenersParams { pub const METHOD: &'static str = "DOMDebugger.getEventListeners"; }
impl crate::CdpCommand for GetEventListenersParams {
const METHOD: &'static str = "DOMDebugger.getEventListeners";
type Response = GetEventListenersReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoveDOMBreakpointParams {
pub nodeId: crate::dom::NodeId,
#[serde(rename = "type")]
pub type_: DOMBreakpointType,
}
impl RemoveDOMBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeDOMBreakpoint"; }
impl crate::CdpCommand for RemoveDOMBreakpointParams {
const METHOD: &'static str = "DOMDebugger.removeDOMBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoveEventListenerBreakpointParams {
pub eventName: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub targetName: Option<String>,
}
impl RemoveEventListenerBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeEventListenerBreakpoint"; }
impl crate::CdpCommand for RemoveEventListenerBreakpointParams {
const METHOD: &'static str = "DOMDebugger.removeEventListenerBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoveInstrumentationBreakpointParams {
pub eventName: String,
}
impl RemoveInstrumentationBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeInstrumentationBreakpoint"; }
impl crate::CdpCommand for RemoveInstrumentationBreakpointParams {
const METHOD: &'static str = "DOMDebugger.removeInstrumentationBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RemoveXHRBreakpointParams {
pub url: String,
}
impl RemoveXHRBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.removeXHRBreakpoint"; }
impl crate::CdpCommand for RemoveXHRBreakpointParams {
const METHOD: &'static str = "DOMDebugger.removeXHRBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetBreakOnCSPViolationParams {
pub violationTypes: Vec<CSPViolationType>,
}
impl SetBreakOnCSPViolationParams { pub const METHOD: &'static str = "DOMDebugger.setBreakOnCSPViolation"; }
impl crate::CdpCommand for SetBreakOnCSPViolationParams {
const METHOD: &'static str = "DOMDebugger.setBreakOnCSPViolation";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetDOMBreakpointParams {
pub nodeId: crate::dom::NodeId,
#[serde(rename = "type")]
pub type_: DOMBreakpointType,
}
impl SetDOMBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setDOMBreakpoint"; }
impl crate::CdpCommand for SetDOMBreakpointParams {
const METHOD: &'static str = "DOMDebugger.setDOMBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetEventListenerBreakpointParams {
pub eventName: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub targetName: Option<String>,
}
impl SetEventListenerBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setEventListenerBreakpoint"; }
impl crate::CdpCommand for SetEventListenerBreakpointParams {
const METHOD: &'static str = "DOMDebugger.setEventListenerBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetInstrumentationBreakpointParams {
pub eventName: String,
}
impl SetInstrumentationBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setInstrumentationBreakpoint"; }
impl crate::CdpCommand for SetInstrumentationBreakpointParams {
const METHOD: &'static str = "DOMDebugger.setInstrumentationBreakpoint";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct SetXHRBreakpointParams {
pub url: String,
}
impl SetXHRBreakpointParams { pub const METHOD: &'static str = "DOMDebugger.setXHRBreakpoint"; }
impl crate::CdpCommand for SetXHRBreakpointParams {
const METHOD: &'static str = "DOMDebugger.setXHRBreakpoint";
type Response = crate::EmptyReturns;
}