Last active
June 23, 2022 03:58
-
-
Save flier/5a3eab35793b5fee35279adc313040a3 to your computer and use it in GitHub Desktop.
Generated Rust binding file for Chrome DevTools Protocol (.PDL) definition files
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::{Serialize, Deserialize}; | |
use crate::CallSite; | |
#[cfg(feature = "async")] | |
use futures::Future; | |
#[cfg(feature = "async")] | |
use crate::AsyncCallSite; | |
/// Copyright 2017 The Chromium Authors. All rights reserved. | |
/// Use of this source code is governed by a BSD-style license that can be | |
/// found in the LICENSE file. | |
/// | |
/// Contributing to Chrome DevTools Protocol: https://docs.google.com/document/d/1c-COD2kaK__5iMM5SEx-PzNA7HFmgttcYfOHHX0HaOM/edit?usp=sharing | |
#[doc(hidden)] | |
pub const BROWSER_PROTOCOL_VERSION: &str = "1.3"; | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "accessibility"))] | |
pub trait Accessibility: DOM { | |
type Error; | |
/// Disables the accessibility domain. | |
fn disable(&mut self) -> Result<(), <Self as Accessibility>::Error>; | |
/// Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls. | |
/// This turns on accessibility for the page, which can impact performance until accessibility is disabled. | |
fn enable(&mut self) -> Result<(), <Self as Accessibility>::Error>; | |
/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists. | |
#[cfg(feature = "experimental")] | |
fn get_partial_ax_tree(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, fetch_relatives: Option<Boolean>) -> Result<(Vec<accessibility::AXNode>), <Self as Accessibility>::Error>; | |
/// Fetches the entire accessibility tree | |
#[cfg(feature = "experimental")] | |
fn get_full_ax_tree(&mut self) -> Result<(Vec<accessibility::AXNode>), <Self as Accessibility>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "accessibility"))] | |
impl<T> Accessibility for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as Accessibility>::Error> { | |
CallSite::call(self, accessibility::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Accessibility>::Error> { | |
CallSite::call(self, accessibility::EnableRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_partial_ax_tree(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, fetch_relatives: Option<Boolean>) -> Result<(Vec<accessibility::AXNode>), <Self as Accessibility>::Error> { | |
CallSite::call(self, accessibility::GetPartialAXTreeRequest { node_id, backend_node_id, object_id, fetch_relatives }).map(|res| (res.nodes)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_full_ax_tree(&mut self) -> Result<(Vec<accessibility::AXNode>), <Self as Accessibility>::Error> { | |
CallSite::call(self, accessibility::GetFullAXTreeRequest {}).map(|res| (res.nodes)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "accessibility")))] | |
pub trait AsyncAccessibility: AsyncDOM where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncAccessibility>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncAccessibility>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetPartialAXTree: futures::Future<Item = ((Vec<accessibility::AXNode>), Self), Error = <Self as AsyncAccessibility>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetFullAXTree: futures::Future<Item = ((Vec<accessibility::AXNode>), Self), Error = <Self as AsyncAccessibility>::Error>; | |
/// Disables the accessibility domain. | |
fn disable(self) -> <Self as AsyncAccessibility>::Disable; | |
/// Enables the accessibility domain which causes `AXNodeId`s to remain consistent between method calls. | |
/// This turns on accessibility for the page, which can impact performance until accessibility is disabled. | |
fn enable(self) -> <Self as AsyncAccessibility>::Enable; | |
/// Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists. | |
#[cfg(feature = "experimental")] | |
fn get_partial_ax_tree(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, fetch_relatives: Option<Boolean>) -> <Self as AsyncAccessibility>::GetPartialAXTree; | |
/// Fetches the entire accessibility tree | |
#[cfg(feature = "experimental")] | |
fn get_full_ax_tree(self) -> <Self as AsyncAccessibility>::GetFullAXTree; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "accessibility")))] | |
impl<T> AsyncAccessibility for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetPartialAXTree = Box<dyn futures::Future<Item = ((Vec<accessibility::AXNode>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetFullAXTree = Box<dyn futures::Future<Item = ((Vec<accessibility::AXNode>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncAccessibility>::Disable { | |
Box::new(AsyncCallSite::async_call(self, accessibility::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncAccessibility>::Enable { | |
Box::new(AsyncCallSite::async_call(self, accessibility::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_partial_ax_tree(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, fetch_relatives: Option<Boolean>) -> <Self as AsyncAccessibility>::GetPartialAXTree { | |
Box::new(AsyncCallSite::async_call(self, accessibility::GetPartialAXTreeRequest { node_id, backend_node_id, object_id, fetch_relatives }).map(|(res, self_)| ((res.nodes), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_full_ax_tree(self) -> <Self as AsyncAccessibility>::GetFullAXTree { | |
Box::new(AsyncCallSite::async_call(self, accessibility::GetFullAXTreeRequest {}).map(|(res, self_)| ((res.nodes), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "accessibility"))] | |
#[allow(deprecated)] | |
pub mod accessibility { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique accessibility node identifier. | |
pub type AXNodeId = String; | |
/// Enum of possible property types. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AXValueType { | |
Boolean, | |
Tristate, | |
BooleanOrUndefined, | |
Idref, | |
IdrefList, | |
Integer, | |
Node, | |
NodeList, | |
Number, | |
String, | |
ComputedString, | |
Token, | |
TokenList, | |
DomRelation, | |
Role, | |
InternalRole, | |
ValueUndefined, | |
} | |
/// Enum of possible property sources. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AXValueSourceType { | |
Attribute, | |
Implicit, | |
Style, | |
Contents, | |
Placeholder, | |
RelatedElement, | |
} | |
/// Enum of possible native property sources (as a subtype of a particular AXValueSourceType). | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AXValueNativeSourceType { | |
Figcaption, | |
Label, | |
Labelfor, | |
Labelwrapped, | |
Legend, | |
Tablecaption, | |
Title, | |
Other, | |
} | |
/// A single source for a computed AX property. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AXValueSource { | |
/// What type of source this is. | |
#[serde(rename = "type")] | |
pub r#type: AXValueSourceType, | |
/// The value of this property source. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub value: Option<AXValue>, | |
/// The name of the relevant attribute, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attribute: Option<String>, | |
/// The value of the relevant attribute, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attribute_value: Option<AXValue>, | |
/// Whether this source is superseded by a higher priority source. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub superseded: Option<Boolean>, | |
/// The native markup source for this value, e.g. a <label> element. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub native_source: Option<AXValueNativeSourceType>, | |
/// The value, such as a node or node list, of the native source. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub native_source_value: Option<AXValue>, | |
/// Whether the value for this property is invalid. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub invalid: Option<Boolean>, | |
/// Reason for the value being invalid, if it is. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub invalid_reason: Option<String>, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AXRelatedNode { | |
/// The BackendNodeId of the related DOM node. | |
#[serde(rename = "backendDOMNodeId")] | |
pub backend_dom_node_id: dom::BackendNodeId, | |
/// The IDRef value provided, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub idref: Option<String>, | |
/// The text alternative of this node in the current context. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub text: Option<String>, | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AXProperty { | |
/// The name of this property. | |
pub name: AXPropertyName, | |
/// The value of this property. | |
pub value: AXValue, | |
} | |
/// A single computed AX property. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AXValue { | |
/// The type of this value. | |
#[serde(rename = "type")] | |
pub r#type: AXValueType, | |
/// The computed value of this property. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub value: Option<Any>, | |
/// One or more related nodes, if applicable. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub related_nodes: Option<Vec<AXRelatedNode>>, | |
/// The sources which contributed to the computation of this property. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sources: Option<Vec<AXValueSource>>, | |
} | |
/// Values of AXProperty name: | |
/// - from 'busy' to 'roledescription': states which apply to every AX node | |
/// - from 'live' to 'root': attributes which apply to nodes in live regions | |
/// - from 'autocomplete' to 'valuetext': attributes which apply to widgets | |
/// - from 'checked' to 'selected': states which apply to widgets | |
/// - from 'activedescendant' to 'owns' - relationships between elements other than parent/child/sibling. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AXPropertyName { | |
Busy, | |
Disabled, | |
Editable, | |
Focusable, | |
Focused, | |
Hidden, | |
HiddenRoot, | |
Invalid, | |
Keyshortcuts, | |
Settable, | |
Roledescription, | |
Live, | |
Atomic, | |
Relevant, | |
Root, | |
Autocomplete, | |
HasPopup, | |
Level, | |
Multiselectable, | |
Orientation, | |
Multiline, | |
Readonly, | |
Required, | |
Valuemin, | |
Valuemax, | |
Valuetext, | |
Checked, | |
Expanded, | |
Modal, | |
Pressed, | |
Selected, | |
Activedescendant, | |
Controls, | |
Describedby, | |
Details, | |
Errormessage, | |
Flowto, | |
Labelledby, | |
Owns, | |
} | |
/// A node in the accessibility tree. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AXNode { | |
/// Unique identifier for this node. | |
pub node_id: AXNodeId, | |
/// Whether this node is ignored for accessibility | |
pub ignored: Boolean, | |
/// Collection of reasons why this node is hidden. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub ignored_reasons: Option<Vec<AXProperty>>, | |
/// This `Node`'s role, whether explicit or implicit. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub role: Option<AXValue>, | |
/// The accessible name for this `Node`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub name: Option<AXValue>, | |
/// The accessible description for this `Node`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub description: Option<AXValue>, | |
/// The value for this `Node`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub value: Option<AXValue>, | |
/// All other properties | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub properties: Option<Vec<AXProperty>>, | |
/// IDs for each of this node's child nodes. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub child_ids: Option<Vec<AXNodeId>>, | |
/// The backend ID for the associated DOM node, if any. | |
#[serde(rename = "backendDOMNodeId")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_dom_node_id: Option<dom::BackendNodeId>, | |
} | |
/// Method parameters of the `Accessibility::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Accessibility::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Accessibility::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Accessibility::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Accessibility.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Accessibility::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Accessibility::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Accessibility::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Accessibility::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Accessibility.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Accessibility::getPartialAXTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetPartialAXTree = GetPartialAXTreeRequest; | |
/// Return object of the `Accessibility::getPartialAXTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetPartialAXTreeReturnObject = GetPartialAXTreeResponse; | |
/// Request object of the `Accessibility::getPartialAXTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPartialAXTreeRequest { | |
/// Identifier of the node to get the partial accessibility tree for. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<dom::NodeId>, | |
/// Identifier of the backend node to get the partial accessibility tree for. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
/// JavaScript object id of the node wrapper to get the partial accessibility tree for. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
/// Whether to fetch this nodes ancestors, siblings and children. Defaults to true. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub fetch_relatives: Option<Boolean>, | |
} | |
/// Response object of the `Accessibility::getPartialAXTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPartialAXTreeResponse { | |
/// The `Accessibility.AXNode` for this DOM node, if it exists, plus its ancestors, siblings and | |
/// children, if requested. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub nodes: Vec<AXNode>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetPartialAXTree { | |
const NAME: &'static str = "Accessibility.getPartialAXTree"; | |
type ReturnObject = GetPartialAXTreeReturnObject; | |
} | |
/// Method parameters of the `Accessibility::getFullAXTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFullAXTree = GetFullAXTreeRequest; | |
/// Return object of the `Accessibility::getFullAXTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFullAXTreeReturnObject = GetFullAXTreeResponse; | |
/// Request object of the `Accessibility::getFullAXTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFullAXTreeRequest { | |
} | |
/// Response object of the `Accessibility::getFullAXTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFullAXTreeResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub nodes: Vec<AXNode>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetFullAXTree { | |
const NAME: &'static str = "Accessibility.getFullAXTree"; | |
type ReturnObject = GetFullAXTreeReturnObject; | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "animation"))] | |
pub trait Animation: Runtime + DOM { | |
type Error; | |
/// Disables animation domain notifications. | |
fn disable(&mut self) -> Result<(), <Self as Animation>::Error>; | |
/// Enables animation domain notifications. | |
fn enable(&mut self) -> Result<(), <Self as Animation>::Error>; | |
/// Returns the current time of the an animation. | |
fn get_current_time(&mut self, id: String) -> Result<(Number), <Self as Animation>::Error>; | |
/// Gets the playback rate of the document timeline. | |
fn get_playback_rate(&mut self) -> Result<(Number), <Self as Animation>::Error>; | |
/// Releases a set of animations to no longer be manipulated. | |
fn release_animations(&mut self, animations: Vec<String>) -> Result<(), <Self as Animation>::Error>; | |
/// Gets the remote object of the Animation. | |
fn resolve_animation(&mut self, animation_id: String) -> Result<(runtime::RemoteObject), <Self as Animation>::Error>; | |
/// Seek a set of animations to a particular time within each animation. | |
fn seek_animations(&mut self, animations: Vec<String>, current_time: Number) -> Result<(), <Self as Animation>::Error>; | |
/// Sets the paused state of a set of animations. | |
fn set_paused(&mut self, animations: Vec<String>, paused: Boolean) -> Result<(), <Self as Animation>::Error>; | |
/// Sets the playback rate of the document timeline. | |
fn set_playback_rate(&mut self, playback_rate: Number) -> Result<(), <Self as Animation>::Error>; | |
/// Sets the timing of an animation node. | |
fn set_timing(&mut self, animation_id: String, duration: Number, delay: Number) -> Result<(), <Self as Animation>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "animation"))] | |
impl<T> Animation for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::EnableRequest {}).map(|_| ()) | |
} | |
fn get_current_time(&mut self, id: String) -> Result<(Number), <Self as Animation>::Error> { | |
CallSite::call(self, animation::GetCurrentTimeRequest { id }).map(|res| (res.current_time)) | |
} | |
fn get_playback_rate(&mut self) -> Result<(Number), <Self as Animation>::Error> { | |
CallSite::call(self, animation::GetPlaybackRateRequest {}).map(|res| (res.playback_rate)) | |
} | |
fn release_animations(&mut self, animations: Vec<String>) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::ReleaseAnimationsRequest { animations }).map(|_| ()) | |
} | |
fn resolve_animation(&mut self, animation_id: String) -> Result<(runtime::RemoteObject), <Self as Animation>::Error> { | |
CallSite::call(self, animation::ResolveAnimationRequest { animation_id }).map(|res| (res.remote_object)) | |
} | |
fn seek_animations(&mut self, animations: Vec<String>, current_time: Number) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::SeekAnimationsRequest { animations, current_time }).map(|_| ()) | |
} | |
fn set_paused(&mut self, animations: Vec<String>, paused: Boolean) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::SetPausedRequest { animations, paused }).map(|_| ()) | |
} | |
fn set_playback_rate(&mut self, playback_rate: Number) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::SetPlaybackRateRequest { playback_rate }).map(|_| ()) | |
} | |
fn set_timing(&mut self, animation_id: String, duration: Number, delay: Number) -> Result<(), <Self as Animation>::Error> { | |
CallSite::call(self, animation::SetTimingRequest { animation_id, duration, delay }).map(|_| ()) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "animation")))] | |
pub trait AsyncAnimation: AsyncRuntime + AsyncDOM where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type GetCurrentTime: futures::Future<Item = ((Number), Self), Error = <Self as AsyncAnimation>::Error>; | |
type GetPlaybackRate: futures::Future<Item = ((Number), Self), Error = <Self as AsyncAnimation>::Error>; | |
type ReleaseAnimations: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type ResolveAnimation: futures::Future<Item = ((runtime::RemoteObject), Self), Error = <Self as AsyncAnimation>::Error>; | |
type SeekAnimations: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type SetPaused: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type SetPlaybackRate: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
type SetTiming: futures::Future<Item = ((), Self), Error = <Self as AsyncAnimation>::Error>; | |
/// Disables animation domain notifications. | |
fn disable(self) -> <Self as AsyncAnimation>::Disable; | |
/// Enables animation domain notifications. | |
fn enable(self) -> <Self as AsyncAnimation>::Enable; | |
/// Returns the current time of the an animation. | |
fn get_current_time(self, id: String) -> <Self as AsyncAnimation>::GetCurrentTime; | |
/// Gets the playback rate of the document timeline. | |
fn get_playback_rate(self) -> <Self as AsyncAnimation>::GetPlaybackRate; | |
/// Releases a set of animations to no longer be manipulated. | |
fn release_animations(self, animations: Vec<String>) -> <Self as AsyncAnimation>::ReleaseAnimations; | |
/// Gets the remote object of the Animation. | |
fn resolve_animation(self, animation_id: String) -> <Self as AsyncAnimation>::ResolveAnimation; | |
/// Seek a set of animations to a particular time within each animation. | |
fn seek_animations(self, animations: Vec<String>, current_time: Number) -> <Self as AsyncAnimation>::SeekAnimations; | |
/// Sets the paused state of a set of animations. | |
fn set_paused(self, animations: Vec<String>, paused: Boolean) -> <Self as AsyncAnimation>::SetPaused; | |
/// Sets the playback rate of the document timeline. | |
fn set_playback_rate(self, playback_rate: Number) -> <Self as AsyncAnimation>::SetPlaybackRate; | |
/// Sets the timing of an animation node. | |
fn set_timing(self, animation_id: String, duration: Number, delay: Number) -> <Self as AsyncAnimation>::SetTiming; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "animation")))] | |
impl<T> AsyncAnimation for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetCurrentTime = Box<dyn futures::Future<Item = ((Number), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetPlaybackRate = Box<dyn futures::Future<Item = ((Number), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ReleaseAnimations = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ResolveAnimation = Box<dyn futures::Future<Item = ((runtime::RemoteObject), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SeekAnimations = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetPaused = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetPlaybackRate = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetTiming = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncAnimation>::Disable { | |
Box::new(AsyncCallSite::async_call(self, animation::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncAnimation>::Enable { | |
Box::new(AsyncCallSite::async_call(self, animation::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_current_time(self, id: String) -> <Self as AsyncAnimation>::GetCurrentTime { | |
Box::new(AsyncCallSite::async_call(self, animation::GetCurrentTimeRequest { id }).map(|(res, self_)| ((res.current_time), self_))) | |
} | |
fn get_playback_rate(self) -> <Self as AsyncAnimation>::GetPlaybackRate { | |
Box::new(AsyncCallSite::async_call(self, animation::GetPlaybackRateRequest {}).map(|(res, self_)| ((res.playback_rate), self_))) | |
} | |
fn release_animations(self, animations: Vec<String>) -> <Self as AsyncAnimation>::ReleaseAnimations { | |
Box::new(AsyncCallSite::async_call(self, animation::ReleaseAnimationsRequest { animations }).map(|(_, self_)| ((), self_))) | |
} | |
fn resolve_animation(self, animation_id: String) -> <Self as AsyncAnimation>::ResolveAnimation { | |
Box::new(AsyncCallSite::async_call(self, animation::ResolveAnimationRequest { animation_id }).map(|(res, self_)| ((res.remote_object), self_))) | |
} | |
fn seek_animations(self, animations: Vec<String>, current_time: Number) -> <Self as AsyncAnimation>::SeekAnimations { | |
Box::new(AsyncCallSite::async_call(self, animation::SeekAnimationsRequest { animations, current_time }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_paused(self, animations: Vec<String>, paused: Boolean) -> <Self as AsyncAnimation>::SetPaused { | |
Box::new(AsyncCallSite::async_call(self, animation::SetPausedRequest { animations, paused }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_playback_rate(self, playback_rate: Number) -> <Self as AsyncAnimation>::SetPlaybackRate { | |
Box::new(AsyncCallSite::async_call(self, animation::SetPlaybackRateRequest { playback_rate }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_timing(self, animation_id: String, duration: Number, delay: Number) -> <Self as AsyncAnimation>::SetTiming { | |
Box::new(AsyncCallSite::async_call(self, animation::SetTimingRequest { animation_id, duration, delay }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "animation"))] | |
#[allow(deprecated)] | |
pub mod animation { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Animation instance. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Animation { | |
/// `Animation`'s id. | |
pub id: String, | |
/// `Animation`'s name. | |
pub name: String, | |
/// `Animation`'s internal paused state. | |
pub paused_state: Boolean, | |
/// `Animation`'s play state. | |
pub play_state: String, | |
/// `Animation`'s playback rate. | |
pub playback_rate: Number, | |
/// `Animation`'s start time. | |
pub start_time: Number, | |
/// `Animation`'s current time. | |
pub current_time: Number, | |
/// Animation type of `Animation`. | |
#[serde(rename = "type")] | |
pub r#type: AnimationType, | |
/// `Animation`'s source animation node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub source: Option<AnimationEffect>, | |
/// A unique ID for `Animation` representing the sources that triggered this CSS | |
/// animation/transition. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub css_id: Option<String>, | |
} | |
/// Allow values for the `Animation::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AnimationType { | |
CSSTransition, | |
CSSAnimation, | |
WebAnimation, | |
} | |
/// AnimationEffect instance | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AnimationEffect { | |
/// `AnimationEffect`'s delay. | |
pub delay: Number, | |
/// `AnimationEffect`'s end delay. | |
pub end_delay: Number, | |
/// `AnimationEffect`'s iteration start. | |
pub iteration_start: Number, | |
/// `AnimationEffect`'s iterations. | |
pub iterations: Number, | |
/// `AnimationEffect`'s iteration duration. | |
pub duration: Number, | |
/// `AnimationEffect`'s playback direction. | |
pub direction: String, | |
/// `AnimationEffect`'s fill mode. | |
pub fill: String, | |
/// `AnimationEffect`'s target node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
/// `AnimationEffect`'s keyframes. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub keyframes_rule: Option<KeyframesRule>, | |
/// `AnimationEffect`'s timing function. | |
pub easing: String, | |
} | |
/// Keyframes Rule | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct KeyframesRule { | |
/// CSS keyframed animation's name. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub name: Option<String>, | |
/// List of animation keyframes. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub keyframes: Vec<KeyframeStyle>, | |
} | |
/// Keyframe Style | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct KeyframeStyle { | |
/// Keyframe's time offset. | |
pub offset: String, | |
/// `AnimationEffect`'s timing function. | |
pub easing: String, | |
} | |
/// Method parameters of the `Animation::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Animation::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Animation::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Animation::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Animation.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Animation::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Animation::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Animation::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Animation::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Animation.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Animation::getCurrentTime` command. | |
pub type GetCurrentTime = GetCurrentTimeRequest; | |
/// Return object of the `Animation::getCurrentTime` command. | |
pub type GetCurrentTimeReturnObject = GetCurrentTimeResponse; | |
/// Request object of the `Animation::getCurrentTime` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCurrentTimeRequest { | |
/// Id of animation. | |
pub id: String, | |
} | |
/// Response object of the `Animation::getCurrentTime` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCurrentTimeResponse { | |
/// Current time of the page. | |
pub current_time: Number, | |
} | |
impl Method for GetCurrentTime { | |
const NAME: &'static str = "Animation.getCurrentTime"; | |
type ReturnObject = GetCurrentTimeReturnObject; | |
} | |
/// Method parameters of the `Animation::getPlaybackRate` command. | |
pub type GetPlaybackRate = GetPlaybackRateRequest; | |
/// Return object of the `Animation::getPlaybackRate` command. | |
pub type GetPlaybackRateReturnObject = GetPlaybackRateResponse; | |
/// Request object of the `Animation::getPlaybackRate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPlaybackRateRequest { | |
} | |
/// Response object of the `Animation::getPlaybackRate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPlaybackRateResponse { | |
/// Playback rate for animations on page. | |
pub playback_rate: Number, | |
} | |
impl Method for GetPlaybackRate { | |
const NAME: &'static str = "Animation.getPlaybackRate"; | |
type ReturnObject = GetPlaybackRateReturnObject; | |
} | |
/// Method parameters of the `Animation::releaseAnimations` command. | |
pub type ReleaseAnimations = ReleaseAnimationsRequest; | |
/// Return object of the `Animation::releaseAnimations` command. | |
pub type ReleaseAnimationsReturnObject = ReleaseAnimationsResponse; | |
/// Request object of the `Animation::releaseAnimations` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReleaseAnimationsRequest { | |
/// List of animation ids to seek. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub animations: Vec<String>, | |
} | |
/// Response object of the `Animation::releaseAnimations` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReleaseAnimationsResponse { | |
} | |
impl Method for ReleaseAnimations { | |
const NAME: &'static str = "Animation.releaseAnimations"; | |
type ReturnObject = ReleaseAnimationsReturnObject; | |
} | |
/// Method parameters of the `Animation::resolveAnimation` command. | |
pub type ResolveAnimation = ResolveAnimationRequest; | |
/// Return object of the `Animation::resolveAnimation` command. | |
pub type ResolveAnimationReturnObject = ResolveAnimationResponse; | |
/// Request object of the `Animation::resolveAnimation` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveAnimationRequest { | |
/// Animation id. | |
pub animation_id: String, | |
} | |
/// Response object of the `Animation::resolveAnimation` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveAnimationResponse { | |
/// Corresponding remote object. | |
pub remote_object: runtime::RemoteObject, | |
} | |
impl Method for ResolveAnimation { | |
const NAME: &'static str = "Animation.resolveAnimation"; | |
type ReturnObject = ResolveAnimationReturnObject; | |
} | |
/// Method parameters of the `Animation::seekAnimations` command. | |
pub type SeekAnimations = SeekAnimationsRequest; | |
/// Return object of the `Animation::seekAnimations` command. | |
pub type SeekAnimationsReturnObject = SeekAnimationsResponse; | |
/// Request object of the `Animation::seekAnimations` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SeekAnimationsRequest { | |
/// List of animation ids to seek. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub animations: Vec<String>, | |
/// Set the current time of each animation. | |
pub current_time: Number, | |
} | |
/// Response object of the `Animation::seekAnimations` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SeekAnimationsResponse { | |
} | |
impl Method for SeekAnimations { | |
const NAME: &'static str = "Animation.seekAnimations"; | |
type ReturnObject = SeekAnimationsReturnObject; | |
} | |
/// Method parameters of the `Animation::setPaused` command. | |
pub type SetPaused = SetPausedRequest; | |
/// Return object of the `Animation::setPaused` command. | |
pub type SetPausedReturnObject = SetPausedResponse; | |
/// Request object of the `Animation::setPaused` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPausedRequest { | |
/// Animations to set the pause state of. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub animations: Vec<String>, | |
/// Paused state to set to. | |
pub paused: Boolean, | |
} | |
/// Response object of the `Animation::setPaused` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPausedResponse { | |
} | |
impl Method for SetPaused { | |
const NAME: &'static str = "Animation.setPaused"; | |
type ReturnObject = SetPausedReturnObject; | |
} | |
/// Method parameters of the `Animation::setPlaybackRate` command. | |
pub type SetPlaybackRate = SetPlaybackRateRequest; | |
/// Return object of the `Animation::setPlaybackRate` command. | |
pub type SetPlaybackRateReturnObject = SetPlaybackRateResponse; | |
/// Request object of the `Animation::setPlaybackRate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPlaybackRateRequest { | |
/// Playback rate for animations on page | |
pub playback_rate: Number, | |
} | |
/// Response object of the `Animation::setPlaybackRate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPlaybackRateResponse { | |
} | |
impl Method for SetPlaybackRate { | |
const NAME: &'static str = "Animation.setPlaybackRate"; | |
type ReturnObject = SetPlaybackRateReturnObject; | |
} | |
/// Method parameters of the `Animation::setTiming` command. | |
pub type SetTiming = SetTimingRequest; | |
/// Return object of the `Animation::setTiming` command. | |
pub type SetTimingReturnObject = SetTimingResponse; | |
/// Request object of the `Animation::setTiming` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTimingRequest { | |
/// Animation id. | |
pub animation_id: String, | |
/// Duration of the animation. | |
pub duration: Number, | |
/// Delay of the animation. | |
pub delay: Number, | |
} | |
/// Response object of the `Animation::setTiming` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTimingResponse { | |
} | |
impl Method for SetTiming { | |
const NAME: &'static str = "Animation.setTiming"; | |
type ReturnObject = SetTimingReturnObject; | |
} | |
/// Event for when an animation has been cancelled. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AnimationCanceledEvent { | |
/// Id of the animation that was cancelled. | |
pub id: String, | |
} | |
/// Event for each animation that has been created. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AnimationCreatedEvent { | |
/// Id of the animation that was created. | |
pub id: String, | |
} | |
/// Event for animation that has been started. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AnimationStartedEvent { | |
/// Animation that was started. | |
pub animation: Animation, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Event for when an animation has been cancelled. | |
#[serde(rename = "Animation.animationCanceled")] | |
AnimationCanceled(AnimationCanceledEvent), | |
/// Event for each animation that has been created. | |
#[serde(rename = "Animation.animationCreated")] | |
AnimationCreated(AnimationCreatedEvent), | |
/// Event for animation that has been started. | |
#[serde(rename = "Animation.animationStarted")] | |
AnimationStarted(AnimationStartedEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "application_cache"))] | |
pub trait ApplicationCache { | |
type Error; | |
/// Enables application cache domain notifications. | |
fn enable(&mut self) -> Result<(), <Self as ApplicationCache>::Error>; | |
/// Returns relevant application cache data for the document in given frame. | |
fn get_application_cache_for_frame(&mut self, frame_id: page::FrameId) -> Result<(application_cache::ApplicationCache), <Self as ApplicationCache>::Error>; | |
/// Returns array of frame identifiers with manifest urls for each frame containing a document | |
/// associated with some application cache. | |
fn get_frames_with_manifests(&mut self) -> Result<(Vec<application_cache::FrameWithManifest>), <Self as ApplicationCache>::Error>; | |
/// Returns manifest URL for document in the given frame. | |
fn get_manifest_for_frame(&mut self, frame_id: page::FrameId) -> Result<(String), <Self as ApplicationCache>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "application_cache"))] | |
impl<T> ApplicationCache for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn enable(&mut self) -> Result<(), <Self as ApplicationCache>::Error> { | |
CallSite::call(self, application_cache::EnableRequest {}).map(|_| ()) | |
} | |
fn get_application_cache_for_frame(&mut self, frame_id: page::FrameId) -> Result<(application_cache::ApplicationCache), <Self as ApplicationCache>::Error> { | |
CallSite::call(self, application_cache::GetApplicationCacheForFrameRequest { frame_id }).map(|res| (res.application_cache)) | |
} | |
fn get_frames_with_manifests(&mut self) -> Result<(Vec<application_cache::FrameWithManifest>), <Self as ApplicationCache>::Error> { | |
CallSite::call(self, application_cache::GetFramesWithManifestsRequest {}).map(|res| (res.frame_ids)) | |
} | |
fn get_manifest_for_frame(&mut self, frame_id: page::FrameId) -> Result<(String), <Self as ApplicationCache>::Error> { | |
CallSite::call(self, application_cache::GetManifestForFrameRequest { frame_id }).map(|res| (res.manifest_url)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "application_cache")))] | |
pub trait AsyncApplicationCache where Self: Sized { | |
type Error; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncApplicationCache>::Error>; | |
type GetApplicationCacheForFrame: futures::Future<Item = ((application_cache::ApplicationCache), Self), Error = <Self as AsyncApplicationCache>::Error>; | |
type GetFramesWithManifests: futures::Future<Item = ((Vec<application_cache::FrameWithManifest>), Self), Error = <Self as AsyncApplicationCache>::Error>; | |
type GetManifestForFrame: futures::Future<Item = ((String), Self), Error = <Self as AsyncApplicationCache>::Error>; | |
/// Enables application cache domain notifications. | |
fn enable(self) -> <Self as AsyncApplicationCache>::Enable; | |
/// Returns relevant application cache data for the document in given frame. | |
fn get_application_cache_for_frame(self, frame_id: page::FrameId) -> <Self as AsyncApplicationCache>::GetApplicationCacheForFrame; | |
/// Returns array of frame identifiers with manifest urls for each frame containing a document | |
/// associated with some application cache. | |
fn get_frames_with_manifests(self) -> <Self as AsyncApplicationCache>::GetFramesWithManifests; | |
/// Returns manifest URL for document in the given frame. | |
fn get_manifest_for_frame(self, frame_id: page::FrameId) -> <Self as AsyncApplicationCache>::GetManifestForFrame; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "application_cache")))] | |
impl<T> AsyncApplicationCache for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetApplicationCacheForFrame = Box<dyn futures::Future<Item = ((application_cache::ApplicationCache), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetFramesWithManifests = Box<dyn futures::Future<Item = ((Vec<application_cache::FrameWithManifest>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetManifestForFrame = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn enable(self) -> <Self as AsyncApplicationCache>::Enable { | |
Box::new(AsyncCallSite::async_call(self, application_cache::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_application_cache_for_frame(self, frame_id: page::FrameId) -> <Self as AsyncApplicationCache>::GetApplicationCacheForFrame { | |
Box::new(AsyncCallSite::async_call(self, application_cache::GetApplicationCacheForFrameRequest { frame_id }).map(|(res, self_)| ((res.application_cache), self_))) | |
} | |
fn get_frames_with_manifests(self) -> <Self as AsyncApplicationCache>::GetFramesWithManifests { | |
Box::new(AsyncCallSite::async_call(self, application_cache::GetFramesWithManifestsRequest {}).map(|(res, self_)| ((res.frame_ids), self_))) | |
} | |
fn get_manifest_for_frame(self, frame_id: page::FrameId) -> <Self as AsyncApplicationCache>::GetManifestForFrame { | |
Box::new(AsyncCallSite::async_call(self, application_cache::GetManifestForFrameRequest { frame_id }).map(|(res, self_)| ((res.manifest_url), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "application_cache"))] | |
#[allow(deprecated)] | |
pub mod application_cache { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Detailed application cache resource information. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ApplicationCacheResource { | |
/// Resource url. | |
pub url: String, | |
/// Resource size. | |
pub size: Integer, | |
/// Resource type. | |
#[serde(rename = "type")] | |
pub r#type: String, | |
} | |
/// Detailed application cache information. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ApplicationCache { | |
/// Manifest URL. | |
#[serde(rename = "manifestURL")] | |
pub manifest_url: String, | |
/// Application cache size. | |
pub size: Number, | |
/// Application cache creation time. | |
pub creation_time: Number, | |
/// Application cache update time. | |
pub update_time: Number, | |
/// Application cache resources. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub resources: Vec<ApplicationCacheResource>, | |
} | |
/// Frame identifier - manifest URL pair. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FrameWithManifest { | |
/// Frame identifier. | |
pub frame_id: page::FrameId, | |
/// Manifest URL. | |
#[serde(rename = "manifestURL")] | |
pub manifest_url: String, | |
/// Application cache status. | |
pub status: Integer, | |
} | |
/// Method parameters of the `ApplicationCache::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `ApplicationCache::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `ApplicationCache::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `ApplicationCache::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "ApplicationCache.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `ApplicationCache::getApplicationCacheForFrame` command. | |
pub type GetApplicationCacheForFrame = GetApplicationCacheForFrameRequest; | |
/// Return object of the `ApplicationCache::getApplicationCacheForFrame` command. | |
pub type GetApplicationCacheForFrameReturnObject = GetApplicationCacheForFrameResponse; | |
/// Request object of the `ApplicationCache::getApplicationCacheForFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetApplicationCacheForFrameRequest { | |
/// Identifier of the frame containing document whose application cache is retrieved. | |
pub frame_id: page::FrameId, | |
} | |
/// Response object of the `ApplicationCache::getApplicationCacheForFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetApplicationCacheForFrameResponse { | |
/// Relevant application cache data for the document in given frame. | |
pub application_cache: ApplicationCache, | |
} | |
impl Method for GetApplicationCacheForFrame { | |
const NAME: &'static str = "ApplicationCache.getApplicationCacheForFrame"; | |
type ReturnObject = GetApplicationCacheForFrameReturnObject; | |
} | |
/// Method parameters of the `ApplicationCache::getFramesWithManifests` command. | |
pub type GetFramesWithManifests = GetFramesWithManifestsRequest; | |
/// Return object of the `ApplicationCache::getFramesWithManifests` command. | |
pub type GetFramesWithManifestsReturnObject = GetFramesWithManifestsResponse; | |
/// Request object of the `ApplicationCache::getFramesWithManifests` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFramesWithManifestsRequest { | |
} | |
/// Response object of the `ApplicationCache::getFramesWithManifests` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFramesWithManifestsResponse { | |
/// Array of frame identifiers with manifest urls for each frame containing a document | |
/// associated with some application cache. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub frame_ids: Vec<FrameWithManifest>, | |
} | |
impl Method for GetFramesWithManifests { | |
const NAME: &'static str = "ApplicationCache.getFramesWithManifests"; | |
type ReturnObject = GetFramesWithManifestsReturnObject; | |
} | |
/// Method parameters of the `ApplicationCache::getManifestForFrame` command. | |
pub type GetManifestForFrame = GetManifestForFrameRequest; | |
/// Return object of the `ApplicationCache::getManifestForFrame` command. | |
pub type GetManifestForFrameReturnObject = GetManifestForFrameResponse; | |
/// Request object of the `ApplicationCache::getManifestForFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetManifestForFrameRequest { | |
/// Identifier of the frame containing document whose manifest is retrieved. | |
pub frame_id: page::FrameId, | |
} | |
/// Response object of the `ApplicationCache::getManifestForFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetManifestForFrameResponse { | |
/// Manifest URL for document in the given frame. | |
#[serde(rename = "manifestURL")] | |
pub manifest_url: String, | |
} | |
impl Method for GetManifestForFrame { | |
const NAME: &'static str = "ApplicationCache.getManifestForFrame"; | |
type ReturnObject = GetManifestForFrameReturnObject; | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ApplicationCacheStatusUpdatedEvent { | |
/// Identifier of the frame containing document whose application cache updated status. | |
pub frame_id: page::FrameId, | |
/// Manifest URL. | |
#[serde(rename = "manifestURL")] | |
pub manifest_url: String, | |
/// Updated application cache status. | |
pub status: Integer, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NetworkStateUpdatedEvent { | |
pub is_now_online: Boolean, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
#[serde(rename = "ApplicationCache.applicationCacheStatusUpdated")] | |
ApplicationCacheStatusUpdated(ApplicationCacheStatusUpdatedEvent), | |
#[serde(rename = "ApplicationCache.networkStateUpdated")] | |
NetworkStateUpdated(NetworkStateUpdatedEvent), | |
} | |
} | |
/// Audits domain allows investigation of page violations and possible improvements. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "audits"))] | |
pub trait Audits: Network { | |
type Error; | |
/// Returns the response body and size if it were re-encoded with the specified settings. Only | |
/// applies to images. | |
fn get_encoded_response(&mut self, request_id: network::RequestId, encoding: audits::GetEncodedResponseRequestEncoding, quality: Option<Number>, size_only: Option<Boolean>) -> Result<(Option<Binary>, Integer, Integer), <Self as Audits>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "audits"))] | |
impl<T> Audits for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn get_encoded_response(&mut self, request_id: network::RequestId, encoding: audits::GetEncodedResponseRequestEncoding, quality: Option<Number>, size_only: Option<Boolean>) -> Result<(Option<Binary>, Integer, Integer), <Self as Audits>::Error> { | |
CallSite::call(self, audits::GetEncodedResponseRequest { request_id, encoding, quality, size_only }).map(|res| (res.body, res.original_size, res.encoded_size)) | |
} | |
} | |
/// Audits domain allows investigation of page violations and possible improvements. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "audits")))] | |
pub trait AsyncAudits: AsyncNetwork where Self: Sized { | |
type Error; | |
type GetEncodedResponse: futures::Future<Item = ((Option<Binary>, Integer, Integer), Self), Error = <Self as AsyncAudits>::Error>; | |
/// Returns the response body and size if it were re-encoded with the specified settings. Only | |
/// applies to images. | |
fn get_encoded_response(self, request_id: network::RequestId, encoding: audits::GetEncodedResponseRequestEncoding, quality: Option<Number>, size_only: Option<Boolean>) -> <Self as AsyncAudits>::GetEncodedResponse; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "audits")))] | |
impl<T> AsyncAudits for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type GetEncodedResponse = Box<dyn futures::Future<Item = ((Option<Binary>, Integer, Integer), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn get_encoded_response(self, request_id: network::RequestId, encoding: audits::GetEncodedResponseRequestEncoding, quality: Option<Number>, size_only: Option<Boolean>) -> <Self as AsyncAudits>::GetEncodedResponse { | |
Box::new(AsyncCallSite::async_call(self, audits::GetEncodedResponseRequest { request_id, encoding, quality, size_only }).map(|(res, self_)| ((res.body, res.original_size, res.encoded_size), self_))) | |
} | |
} | |
/// Audits domain allows investigation of page violations and possible improvements. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "audits"))] | |
#[allow(deprecated)] | |
pub mod audits { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Method parameters of the `Audits::getEncodedResponse` command. | |
pub type GetEncodedResponse = GetEncodedResponseRequest; | |
/// Return object of the `Audits::getEncodedResponse` command. | |
pub type GetEncodedResponseReturnObject = GetEncodedResponseResponse; | |
/// Request object of the `Audits::getEncodedResponse` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetEncodedResponseRequest { | |
/// Identifier of the network request to get content for. | |
pub request_id: network::RequestId, | |
/// The encoding to use. | |
pub encoding: GetEncodedResponseRequestEncoding, | |
/// The quality of the encoding (0-1). (defaults to 1) | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub quality: Option<Number>, | |
/// Whether to only return the size information (defaults to false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub size_only: Option<Boolean>, | |
} | |
/// Allow values for the `GetEncodedResponseRequest::encoding` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum GetEncodedResponseRequestEncoding { | |
Webp, | |
Jpeg, | |
Png, | |
} | |
/// Response object of the `Audits::getEncodedResponse` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetEncodedResponseResponse { | |
/// The encoded body as a base64 string. Omitted if sizeOnly is true. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub body: Option<Binary>, | |
/// Size before re-encoding. | |
pub original_size: Integer, | |
/// Size after re-encoding. | |
pub encoded_size: Integer, | |
} | |
impl Method for GetEncodedResponse { | |
const NAME: &'static str = "Audits.getEncodedResponse"; | |
type ReturnObject = GetEncodedResponseReturnObject; | |
} | |
} | |
/// Defines events for background web platform features. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "background_service"))] | |
pub trait BackgroundService { | |
type Error; | |
/// Enables event updates for the service. | |
fn start_observing(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error>; | |
/// Disables event updates for the service. | |
fn stop_observing(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error>; | |
/// Set the recording state for the service. | |
fn set_recording(&mut self, should_record: Boolean, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error>; | |
/// Clears all stored data for the service. | |
fn clear_events(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "background_service"))] | |
impl<T> BackgroundService for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn start_observing(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error> { | |
CallSite::call(self, background_service::StartObservingRequest { service }).map(|_| ()) | |
} | |
fn stop_observing(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error> { | |
CallSite::call(self, background_service::StopObservingRequest { service }).map(|_| ()) | |
} | |
fn set_recording(&mut self, should_record: Boolean, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error> { | |
CallSite::call(self, background_service::SetRecordingRequest { should_record, service }).map(|_| ()) | |
} | |
fn clear_events(&mut self, service: background_service::ServiceName) -> Result<(), <Self as BackgroundService>::Error> { | |
CallSite::call(self, background_service::ClearEventsRequest { service }).map(|_| ()) | |
} | |
} | |
/// Defines events for background web platform features. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "background_service")))] | |
pub trait AsyncBackgroundService where Self: Sized { | |
type Error; | |
type StartObserving: futures::Future<Item = ((), Self), Error = <Self as AsyncBackgroundService>::Error>; | |
type StopObserving: futures::Future<Item = ((), Self), Error = <Self as AsyncBackgroundService>::Error>; | |
type SetRecording: futures::Future<Item = ((), Self), Error = <Self as AsyncBackgroundService>::Error>; | |
type ClearEvents: futures::Future<Item = ((), Self), Error = <Self as AsyncBackgroundService>::Error>; | |
/// Enables event updates for the service. | |
fn start_observing(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::StartObserving; | |
/// Disables event updates for the service. | |
fn stop_observing(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::StopObserving; | |
/// Set the recording state for the service. | |
fn set_recording(self, should_record: Boolean, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::SetRecording; | |
/// Clears all stored data for the service. | |
fn clear_events(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::ClearEvents; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "background_service")))] | |
impl<T> AsyncBackgroundService for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type StartObserving = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopObserving = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetRecording = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearEvents = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn start_observing(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::StartObserving { | |
Box::new(AsyncCallSite::async_call(self, background_service::StartObservingRequest { service }).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_observing(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::StopObserving { | |
Box::new(AsyncCallSite::async_call(self, background_service::StopObservingRequest { service }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_recording(self, should_record: Boolean, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::SetRecording { | |
Box::new(AsyncCallSite::async_call(self, background_service::SetRecordingRequest { should_record, service }).map(|(_, self_)| ((), self_))) | |
} | |
fn clear_events(self, service: background_service::ServiceName) -> <Self as AsyncBackgroundService>::ClearEvents { | |
Box::new(AsyncCallSite::async_call(self, background_service::ClearEventsRequest { service }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// Defines events for background web platform features. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "background_service"))] | |
#[allow(deprecated)] | |
pub mod background_service { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// The Background Service that will be associated with the commands/events. | |
/// Every Background Service operates independently, but they share the same | |
/// API. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ServiceName { | |
BackgroundFetch, | |
BackgroundSync, | |
PushMessaging, | |
Notifications, | |
PaymentHandler, | |
PeriodicBackgroundSync, | |
} | |
/// A key-value pair for additional event information to pass along. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EventMetadata { | |
pub key: String, | |
pub value: String, | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BackgroundServiceEvent { | |
/// Timestamp of the event (in seconds). | |
pub timestamp: network::TimeSinceEpoch, | |
/// The origin this event belongs to. | |
pub origin: String, | |
/// The Service Worker ID that initiated the event. | |
pub service_worker_registration_id: service_worker::RegistrationID, | |
/// The Background Service this event belongs to. | |
pub service: ServiceName, | |
/// A description of the event. | |
pub event_name: String, | |
/// An identifier that groups related events together. | |
pub instance_id: String, | |
/// A list of event-specific information. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub event_metadata: Vec<EventMetadata>, | |
} | |
/// Method parameters of the `BackgroundService::startObserving` command. | |
pub type StartObserving = StartObservingRequest; | |
/// Return object of the `BackgroundService::startObserving` command. | |
pub type StartObservingReturnObject = StartObservingResponse; | |
/// Request object of the `BackgroundService::startObserving` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartObservingRequest { | |
pub service: ServiceName, | |
} | |
/// Response object of the `BackgroundService::startObserving` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartObservingResponse { | |
} | |
impl Method for StartObserving { | |
const NAME: &'static str = "BackgroundService.startObserving"; | |
type ReturnObject = StartObservingReturnObject; | |
} | |
/// Method parameters of the `BackgroundService::stopObserving` command. | |
pub type StopObserving = StopObservingRequest; | |
/// Return object of the `BackgroundService::stopObserving` command. | |
pub type StopObservingReturnObject = StopObservingResponse; | |
/// Request object of the `BackgroundService::stopObserving` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopObservingRequest { | |
pub service: ServiceName, | |
} | |
/// Response object of the `BackgroundService::stopObserving` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopObservingResponse { | |
} | |
impl Method for StopObserving { | |
const NAME: &'static str = "BackgroundService.stopObserving"; | |
type ReturnObject = StopObservingReturnObject; | |
} | |
/// Method parameters of the `BackgroundService::setRecording` command. | |
pub type SetRecording = SetRecordingRequest; | |
/// Return object of the `BackgroundService::setRecording` command. | |
pub type SetRecordingReturnObject = SetRecordingResponse; | |
/// Request object of the `BackgroundService::setRecording` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRecordingRequest { | |
pub should_record: Boolean, | |
pub service: ServiceName, | |
} | |
/// Response object of the `BackgroundService::setRecording` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRecordingResponse { | |
} | |
impl Method for SetRecording { | |
const NAME: &'static str = "BackgroundService.setRecording"; | |
type ReturnObject = SetRecordingReturnObject; | |
} | |
/// Method parameters of the `BackgroundService::clearEvents` command. | |
pub type ClearEvents = ClearEventsRequest; | |
/// Return object of the `BackgroundService::clearEvents` command. | |
pub type ClearEventsReturnObject = ClearEventsResponse; | |
/// Request object of the `BackgroundService::clearEvents` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearEventsRequest { | |
pub service: ServiceName, | |
} | |
/// Response object of the `BackgroundService::clearEvents` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearEventsResponse { | |
} | |
impl Method for ClearEvents { | |
const NAME: &'static str = "BackgroundService.clearEvents"; | |
type ReturnObject = ClearEventsReturnObject; | |
} | |
/// Called when the recording state for the service has been updated. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RecordingStateChangedEvent { | |
pub is_recording: Boolean, | |
pub service: ServiceName, | |
} | |
/// Called with all existing backgroundServiceEvents when enabled, and all new | |
/// events afterwards if enabled and recording. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BackgroundServiceEventReceivedEvent { | |
pub background_service_event: BackgroundServiceEvent, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Called when the recording state for the service has been updated. | |
#[serde(rename = "BackgroundService.recordingStateChanged")] | |
RecordingStateChanged(RecordingStateChangedEvent), | |
/// Called with all existing backgroundServiceEvents when enabled, and all new | |
/// events afterwards if enabled and recording. | |
#[serde(rename = "BackgroundService.backgroundServiceEventReceived")] | |
BackgroundServiceEventReceived(BackgroundServiceEventReceivedEvent), | |
} | |
} | |
/// The Browser domain defines methods and events for browser managing. | |
#[cfg(any(feature = "all", feature = "browser"))] | |
pub trait Browser { | |
type Error; | |
/// Set permission settings for given origin. | |
#[cfg(feature = "experimental")] | |
fn set_permission(&mut self, origin: String, permission: browser::PermissionDescriptor, setting: browser::PermissionSetting, browser_context_id: Option<target::TargetID>) -> Result<(), <Self as Browser>::Error>; | |
/// Grant specific permissions to the given origin and reject all others. | |
#[cfg(feature = "experimental")] | |
fn grant_permissions(&mut self, origin: String, permissions: Vec<browser::PermissionType>, browser_context_id: Option<target::BrowserContextID>) -> Result<(), <Self as Browser>::Error>; | |
/// Reset all permission management for all origins. | |
#[cfg(feature = "experimental")] | |
fn reset_permissions(&mut self, browser_context_id: Option<target::BrowserContextID>) -> Result<(), <Self as Browser>::Error>; | |
/// Close browser gracefully. | |
fn close(&mut self) -> Result<(), <Self as Browser>::Error>; | |
/// Crashes browser on the main thread. | |
#[cfg(feature = "experimental")] | |
fn crash(&mut self) -> Result<(), <Self as Browser>::Error>; | |
/// Crashes GPU process. | |
#[cfg(feature = "experimental")] | |
fn crash_gpu_process(&mut self) -> Result<(), <Self as Browser>::Error>; | |
/// Returns version information. | |
fn get_version(&mut self) -> Result<browser::GetVersionResponse, <Self as Browser>::Error>; | |
/// Returns the command line switches for the browser process if, and only if | |
/// --enable-automation is on the commandline. | |
#[cfg(feature = "experimental")] | |
fn get_browser_command_line(&mut self) -> Result<(Vec<String>), <Self as Browser>::Error>; | |
/// Get Chrome histograms. | |
#[cfg(feature = "experimental")] | |
fn get_histograms(&mut self, query: Option<String>, delta: Option<Boolean>) -> Result<(Vec<browser::Histogram>), <Self as Browser>::Error>; | |
/// Get a Chrome histogram by name. | |
#[cfg(feature = "experimental")] | |
fn get_histogram(&mut self, name: String, delta: Option<Boolean>) -> Result<(browser::Histogram), <Self as Browser>::Error>; | |
/// Get position and size of the browser window. | |
#[cfg(feature = "experimental")] | |
fn get_window_bounds(&mut self, window_id: browser::WindowID) -> Result<(browser::Bounds), <Self as Browser>::Error>; | |
/// Get the browser window that contains the devtools target. | |
#[cfg(feature = "experimental")] | |
fn get_window_for_target(&mut self, target_id: Option<target::TargetID>) -> Result<(browser::WindowID, browser::Bounds), <Self as Browser>::Error>; | |
/// Set position and/or size of the browser window. | |
#[cfg(feature = "experimental")] | |
fn set_window_bounds(&mut self, window_id: browser::WindowID, bounds: browser::Bounds) -> Result<(), <Self as Browser>::Error>; | |
/// Set dock tile details, platform-specific. | |
#[cfg(feature = "experimental")] | |
fn set_dock_tile(&mut self, badge_label: Option<String>, image: Option<Binary>) -> Result<(), <Self as Browser>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "browser"))] | |
impl<T> Browser for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
#[cfg(feature = "experimental")] | |
fn set_permission(&mut self, origin: String, permission: browser::PermissionDescriptor, setting: browser::PermissionSetting, browser_context_id: Option<target::TargetID>) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::SetPermissionRequest { origin, permission, setting, browser_context_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn grant_permissions(&mut self, origin: String, permissions: Vec<browser::PermissionType>, browser_context_id: Option<target::BrowserContextID>) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GrantPermissionsRequest { origin, permissions, browser_context_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn reset_permissions(&mut self, browser_context_id: Option<target::BrowserContextID>) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::ResetPermissionsRequest { browser_context_id }).map(|_| ()) | |
} | |
fn close(&mut self) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::CloseRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash(&mut self) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::CrashRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash_gpu_process(&mut self) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::CrashGpuProcessRequest {}).map(|_| ()) | |
} | |
fn get_version(&mut self) -> Result<browser::GetVersionResponse, <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetVersionRequest {}) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_browser_command_line(&mut self) -> Result<(Vec<String>), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetBrowserCommandLineRequest {}).map(|res| (res.arguments)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_histograms(&mut self, query: Option<String>, delta: Option<Boolean>) -> Result<(Vec<browser::Histogram>), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetHistogramsRequest { query, delta }).map(|res| (res.histograms)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_histogram(&mut self, name: String, delta: Option<Boolean>) -> Result<(browser::Histogram), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetHistogramRequest { name, delta }).map(|res| (res.histogram)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_window_bounds(&mut self, window_id: browser::WindowID) -> Result<(browser::Bounds), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetWindowBoundsRequest { window_id }).map(|res| (res.bounds)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_window_for_target(&mut self, target_id: Option<target::TargetID>) -> Result<(browser::WindowID, browser::Bounds), <Self as Browser>::Error> { | |
CallSite::call(self, browser::GetWindowForTargetRequest { target_id }).map(|res| (res.window_id, res.bounds)) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_window_bounds(&mut self, window_id: browser::WindowID, bounds: browser::Bounds) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::SetWindowBoundsRequest { window_id, bounds }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_dock_tile(&mut self, badge_label: Option<String>, image: Option<Binary>) -> Result<(), <Self as Browser>::Error> { | |
CallSite::call(self, browser::SetDockTileRequest { badge_label, image }).map(|_| ()) | |
} | |
} | |
/// The Browser domain defines methods and events for browser managing. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "browser")))] | |
pub trait AsyncBrowser where Self: Sized { | |
type Error; | |
#[cfg(feature = "experimental")] | |
type SetPermission: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GrantPermissions: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type ResetPermissions: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
type Close: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type Crash: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type CrashGpuProcess: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
type GetVersion: futures::Future<Item = (browser::GetVersionResponse, Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetBrowserCommandLine: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetHistograms: futures::Future<Item = ((Vec<browser::Histogram>), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetHistogram: futures::Future<Item = ((browser::Histogram), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetWindowBounds: futures::Future<Item = ((browser::Bounds), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetWindowForTarget: futures::Future<Item = ((browser::WindowID, browser::Bounds), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetWindowBounds: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDockTile: futures::Future<Item = ((), Self), Error = <Self as AsyncBrowser>::Error>; | |
/// Set permission settings for given origin. | |
#[cfg(feature = "experimental")] | |
fn set_permission(self, origin: String, permission: browser::PermissionDescriptor, setting: browser::PermissionSetting, browser_context_id: Option<target::TargetID>) -> <Self as AsyncBrowser>::SetPermission; | |
/// Grant specific permissions to the given origin and reject all others. | |
#[cfg(feature = "experimental")] | |
fn grant_permissions(self, origin: String, permissions: Vec<browser::PermissionType>, browser_context_id: Option<target::BrowserContextID>) -> <Self as AsyncBrowser>::GrantPermissions; | |
/// Reset all permission management for all origins. | |
#[cfg(feature = "experimental")] | |
fn reset_permissions(self, browser_context_id: Option<target::BrowserContextID>) -> <Self as AsyncBrowser>::ResetPermissions; | |
/// Close browser gracefully. | |
fn close(self) -> <Self as AsyncBrowser>::Close; | |
/// Crashes browser on the main thread. | |
#[cfg(feature = "experimental")] | |
fn crash(self) -> <Self as AsyncBrowser>::Crash; | |
/// Crashes GPU process. | |
#[cfg(feature = "experimental")] | |
fn crash_gpu_process(self) -> <Self as AsyncBrowser>::CrashGpuProcess; | |
/// Returns version information. | |
fn get_version(self) -> <Self as AsyncBrowser>::GetVersion; | |
/// Returns the command line switches for the browser process if, and only if | |
/// --enable-automation is on the commandline. | |
#[cfg(feature = "experimental")] | |
fn get_browser_command_line(self) -> <Self as AsyncBrowser>::GetBrowserCommandLine; | |
/// Get Chrome histograms. | |
#[cfg(feature = "experimental")] | |
fn get_histograms(self, query: Option<String>, delta: Option<Boolean>) -> <Self as AsyncBrowser>::GetHistograms; | |
/// Get a Chrome histogram by name. | |
#[cfg(feature = "experimental")] | |
fn get_histogram(self, name: String, delta: Option<Boolean>) -> <Self as AsyncBrowser>::GetHistogram; | |
/// Get position and size of the browser window. | |
#[cfg(feature = "experimental")] | |
fn get_window_bounds(self, window_id: browser::WindowID) -> <Self as AsyncBrowser>::GetWindowBounds; | |
/// Get the browser window that contains the devtools target. | |
#[cfg(feature = "experimental")] | |
fn get_window_for_target(self, target_id: Option<target::TargetID>) -> <Self as AsyncBrowser>::GetWindowForTarget; | |
/// Set position and/or size of the browser window. | |
#[cfg(feature = "experimental")] | |
fn set_window_bounds(self, window_id: browser::WindowID, bounds: browser::Bounds) -> <Self as AsyncBrowser>::SetWindowBounds; | |
/// Set dock tile details, platform-specific. | |
#[cfg(feature = "experimental")] | |
fn set_dock_tile(self, badge_label: Option<String>, image: Option<Binary>) -> <Self as AsyncBrowser>::SetDockTile; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "browser")))] | |
impl<T> AsyncBrowser for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
#[cfg(feature = "experimental")] | |
type SetPermission = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GrantPermissions = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ResetPermissions = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Close = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type Crash = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type CrashGpuProcess = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetVersion = Box<dyn futures::Future<Item = (browser::GetVersionResponse, Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetBrowserCommandLine = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetHistograms = Box<dyn futures::Future<Item = ((Vec<browser::Histogram>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetHistogram = Box<dyn futures::Future<Item = ((browser::Histogram), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetWindowBounds = Box<dyn futures::Future<Item = ((browser::Bounds), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetWindowForTarget = Box<dyn futures::Future<Item = ((browser::WindowID, browser::Bounds), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetWindowBounds = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDockTile = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
fn set_permission(self, origin: String, permission: browser::PermissionDescriptor, setting: browser::PermissionSetting, browser_context_id: Option<target::TargetID>) -> <Self as AsyncBrowser>::SetPermission { | |
Box::new(AsyncCallSite::async_call(self, browser::SetPermissionRequest { origin, permission, setting, browser_context_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn grant_permissions(self, origin: String, permissions: Vec<browser::PermissionType>, browser_context_id: Option<target::BrowserContextID>) -> <Self as AsyncBrowser>::GrantPermissions { | |
Box::new(AsyncCallSite::async_call(self, browser::GrantPermissionsRequest { origin, permissions, browser_context_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn reset_permissions(self, browser_context_id: Option<target::BrowserContextID>) -> <Self as AsyncBrowser>::ResetPermissions { | |
Box::new(AsyncCallSite::async_call(self, browser::ResetPermissionsRequest { browser_context_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn close(self) -> <Self as AsyncBrowser>::Close { | |
Box::new(AsyncCallSite::async_call(self, browser::CloseRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash(self) -> <Self as AsyncBrowser>::Crash { | |
Box::new(AsyncCallSite::async_call(self, browser::CrashRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash_gpu_process(self) -> <Self as AsyncBrowser>::CrashGpuProcess { | |
Box::new(AsyncCallSite::async_call(self, browser::CrashGpuProcessRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_version(self) -> <Self as AsyncBrowser>::GetVersion { | |
(AsyncCallSite::async_call(self, browser::GetVersionRequest {})) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_browser_command_line(self) -> <Self as AsyncBrowser>::GetBrowserCommandLine { | |
Box::new(AsyncCallSite::async_call(self, browser::GetBrowserCommandLineRequest {}).map(|(res, self_)| ((res.arguments), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_histograms(self, query: Option<String>, delta: Option<Boolean>) -> <Self as AsyncBrowser>::GetHistograms { | |
Box::new(AsyncCallSite::async_call(self, browser::GetHistogramsRequest { query, delta }).map(|(res, self_)| ((res.histograms), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_histogram(self, name: String, delta: Option<Boolean>) -> <Self as AsyncBrowser>::GetHistogram { | |
Box::new(AsyncCallSite::async_call(self, browser::GetHistogramRequest { name, delta }).map(|(res, self_)| ((res.histogram), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_window_bounds(self, window_id: browser::WindowID) -> <Self as AsyncBrowser>::GetWindowBounds { | |
Box::new(AsyncCallSite::async_call(self, browser::GetWindowBoundsRequest { window_id }).map(|(res, self_)| ((res.bounds), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_window_for_target(self, target_id: Option<target::TargetID>) -> <Self as AsyncBrowser>::GetWindowForTarget { | |
Box::new(AsyncCallSite::async_call(self, browser::GetWindowForTargetRequest { target_id }).map(|(res, self_)| ((res.window_id, res.bounds), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_window_bounds(self, window_id: browser::WindowID, bounds: browser::Bounds) -> <Self as AsyncBrowser>::SetWindowBounds { | |
Box::new(AsyncCallSite::async_call(self, browser::SetWindowBoundsRequest { window_id, bounds }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_dock_tile(self, badge_label: Option<String>, image: Option<Binary>) -> <Self as AsyncBrowser>::SetDockTile { | |
Box::new(AsyncCallSite::async_call(self, browser::SetDockTileRequest { badge_label, image }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// The Browser domain defines methods and events for browser managing. | |
#[cfg(any(feature = "all", feature = "browser"))] | |
#[allow(deprecated)] | |
pub mod browser { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
pub type WindowID = Integer; | |
/// The state of the browser window. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum WindowState { | |
Normal, | |
Minimized, | |
Maximized, | |
Fullscreen, | |
} | |
/// Browser window bounds information | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Bounds { | |
/// The offset from the left edge of the screen to the window in pixels. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub left: Option<Integer>, | |
/// The offset from the top edge of the screen to the window in pixels. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub top: Option<Integer>, | |
/// The window width in pixels. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub width: Option<Integer>, | |
/// The window height in pixels. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub height: Option<Integer>, | |
/// The window state. Default to normal. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub window_state: Option<WindowState>, | |
} | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum PermissionType { | |
AccessibilityEvents, | |
AudioCapture, | |
BackgroundSync, | |
BackgroundFetch, | |
ClipboardRead, | |
ClipboardWrite, | |
DurableStorage, | |
Flash, | |
Geolocation, | |
Midi, | |
MidiSysex, | |
Notifications, | |
PaymentHandler, | |
PeriodicBackgroundSync, | |
ProtectedMediaIdentifier, | |
Sensors, | |
VideoCapture, | |
IdleDetection, | |
WakeLockScreen, | |
WakeLockSystem, | |
} | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum PermissionSetting { | |
Granted, | |
Denied, | |
Prompt, | |
} | |
/// Definition of PermissionDescriptor defined in the Permissions API: | |
/// https://w3c.github.io/permissions/#dictdef-permissiondescriptor. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PermissionDescriptor { | |
/// Name of permission. | |
/// See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names. | |
pub name: String, | |
/// For "midi" permission, may also specify sysex control. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sysex: Option<Boolean>, | |
/// For "push" permission, may specify userVisibleOnly. | |
/// Note that userVisibleOnly = true is the only currently supported type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub user_visible_only: Option<Boolean>, | |
/// For "wake-lock" permission, must specify type as either "screen" or "system". | |
#[serde(rename = "type")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub r#type: Option<String>, | |
} | |
/// Chrome histogram bucket. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Bucket { | |
/// Minimum value (inclusive). | |
pub low: Integer, | |
/// Maximum value (exclusive). | |
pub high: Integer, | |
/// Number of samples. | |
pub count: Integer, | |
} | |
/// Chrome histogram. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Histogram { | |
/// Name. | |
pub name: String, | |
/// Sum of sample values. | |
pub sum: Integer, | |
/// Total number of samples. | |
pub count: Integer, | |
/// Buckets. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub buckets: Vec<Bucket>, | |
} | |
/// Method parameters of the `Browser::setPermission` command. | |
#[cfg(feature = "experimental")] | |
pub type SetPermission = SetPermissionRequest; | |
/// Return object of the `Browser::setPermission` command. | |
#[cfg(feature = "experimental")] | |
pub type SetPermissionReturnObject = SetPermissionResponse; | |
/// Request object of the `Browser::setPermission` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPermissionRequest { | |
/// Origin the permission applies to. | |
pub origin: String, | |
/// Descriptor of permission to override. | |
pub permission: PermissionDescriptor, | |
/// Setting of the permission. | |
pub setting: PermissionSetting, | |
/// Context to override. When omitted, default browser context is used. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub browser_context_id: Option<target::TargetID>, | |
} | |
/// Response object of the `Browser::setPermission` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPermissionResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetPermission { | |
const NAME: &'static str = "Browser.setPermission"; | |
type ReturnObject = SetPermissionReturnObject; | |
} | |
/// Method parameters of the `Browser::grantPermissions` command. | |
#[cfg(feature = "experimental")] | |
pub type GrantPermissions = GrantPermissionsRequest; | |
/// Return object of the `Browser::grantPermissions` command. | |
#[cfg(feature = "experimental")] | |
pub type GrantPermissionsReturnObject = GrantPermissionsResponse; | |
/// Request object of the `Browser::grantPermissions` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GrantPermissionsRequest { | |
pub origin: String, | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub permissions: Vec<PermissionType>, | |
/// BrowserContext to override permissions. When omitted, default browser context is used. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub browser_context_id: Option<target::BrowserContextID>, | |
} | |
/// Response object of the `Browser::grantPermissions` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GrantPermissionsResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GrantPermissions { | |
const NAME: &'static str = "Browser.grantPermissions"; | |
type ReturnObject = GrantPermissionsReturnObject; | |
} | |
/// Method parameters of the `Browser::resetPermissions` command. | |
#[cfg(feature = "experimental")] | |
pub type ResetPermissions = ResetPermissionsRequest; | |
/// Return object of the `Browser::resetPermissions` command. | |
#[cfg(feature = "experimental")] | |
pub type ResetPermissionsReturnObject = ResetPermissionsResponse; | |
/// Request object of the `Browser::resetPermissions` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetPermissionsRequest { | |
/// BrowserContext to reset permissions. When omitted, default browser context is used. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub browser_context_id: Option<target::BrowserContextID>, | |
} | |
/// Response object of the `Browser::resetPermissions` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetPermissionsResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ResetPermissions { | |
const NAME: &'static str = "Browser.resetPermissions"; | |
type ReturnObject = ResetPermissionsReturnObject; | |
} | |
/// Method parameters of the `Browser::close` command. | |
pub type Close = CloseRequest; | |
/// Return object of the `Browser::close` command. | |
pub type CloseReturnObject = CloseResponse; | |
/// Request object of the `Browser::close` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CloseRequest { | |
} | |
/// Response object of the `Browser::close` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CloseResponse { | |
} | |
impl Method for Close { | |
const NAME: &'static str = "Browser.close"; | |
type ReturnObject = CloseReturnObject; | |
} | |
/// Method parameters of the `Browser::crash` command. | |
#[cfg(feature = "experimental")] | |
pub type Crash = CrashRequest; | |
/// Return object of the `Browser::crash` command. | |
#[cfg(feature = "experimental")] | |
pub type CrashReturnObject = CrashResponse; | |
/// Request object of the `Browser::crash` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CrashRequest { | |
} | |
/// Response object of the `Browser::crash` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CrashResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for Crash { | |
const NAME: &'static str = "Browser.crash"; | |
type ReturnObject = CrashReturnObject; | |
} | |
/// Method parameters of the `Browser::crashGpuProcess` command. | |
#[cfg(feature = "experimental")] | |
pub type CrashGpuProcess = CrashGpuProcessRequest; | |
/// Return object of the `Browser::crashGpuProcess` command. | |
#[cfg(feature = "experimental")] | |
pub type CrashGpuProcessReturnObject = CrashGpuProcessResponse; | |
/// Request object of the `Browser::crashGpuProcess` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CrashGpuProcessRequest { | |
} | |
/// Response object of the `Browser::crashGpuProcess` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CrashGpuProcessResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for CrashGpuProcess { | |
const NAME: &'static str = "Browser.crashGpuProcess"; | |
type ReturnObject = CrashGpuProcessReturnObject; | |
} | |
/// Method parameters of the `Browser::getVersion` command. | |
pub type GetVersion = GetVersionRequest; | |
/// Return object of the `Browser::getVersion` command. | |
pub type GetVersionReturnObject = GetVersionResponse; | |
/// Request object of the `Browser::getVersion` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetVersionRequest { | |
} | |
/// Response object of the `Browser::getVersion` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetVersionResponse { | |
/// Protocol version. | |
pub protocol_version: String, | |
/// Product name. | |
pub product: String, | |
/// Product revision. | |
pub revision: String, | |
/// User-Agent. | |
pub user_agent: String, | |
/// V8 version. | |
pub js_version: String, | |
} | |
impl Method for GetVersion { | |
const NAME: &'static str = "Browser.getVersion"; | |
type ReturnObject = GetVersionReturnObject; | |
} | |
/// Method parameters of the `Browser::getBrowserCommandLine` command. | |
#[cfg(feature = "experimental")] | |
pub type GetBrowserCommandLine = GetBrowserCommandLineRequest; | |
/// Return object of the `Browser::getBrowserCommandLine` command. | |
#[cfg(feature = "experimental")] | |
pub type GetBrowserCommandLineReturnObject = GetBrowserCommandLineResponse; | |
/// Request object of the `Browser::getBrowserCommandLine` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBrowserCommandLineRequest { | |
} | |
/// Response object of the `Browser::getBrowserCommandLine` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBrowserCommandLineResponse { | |
/// Commandline parameters | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub arguments: Vec<String>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetBrowserCommandLine { | |
const NAME: &'static str = "Browser.getBrowserCommandLine"; | |
type ReturnObject = GetBrowserCommandLineReturnObject; | |
} | |
/// Method parameters of the `Browser::getHistograms` command. | |
#[cfg(feature = "experimental")] | |
pub type GetHistograms = GetHistogramsRequest; | |
/// Return object of the `Browser::getHistograms` command. | |
#[cfg(feature = "experimental")] | |
pub type GetHistogramsReturnObject = GetHistogramsResponse; | |
/// Request object of the `Browser::getHistograms` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHistogramsRequest { | |
/// Requested substring in name. Only histograms which have query as a | |
/// substring in their name are extracted. An empty or absent query returns | |
/// all histograms. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub query: Option<String>, | |
/// If true, retrieve delta since last call. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta: Option<Boolean>, | |
} | |
/// Response object of the `Browser::getHistograms` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHistogramsResponse { | |
/// Histograms. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub histograms: Vec<Histogram>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetHistograms { | |
const NAME: &'static str = "Browser.getHistograms"; | |
type ReturnObject = GetHistogramsReturnObject; | |
} | |
/// Method parameters of the `Browser::getHistogram` command. | |
#[cfg(feature = "experimental")] | |
pub type GetHistogram = GetHistogramRequest; | |
/// Return object of the `Browser::getHistogram` command. | |
#[cfg(feature = "experimental")] | |
pub type GetHistogramReturnObject = GetHistogramResponse; | |
/// Request object of the `Browser::getHistogram` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHistogramRequest { | |
/// Requested histogram name. | |
pub name: String, | |
/// If true, retrieve delta since last call. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta: Option<Boolean>, | |
} | |
/// Response object of the `Browser::getHistogram` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHistogramResponse { | |
/// Histogram. | |
pub histogram: Histogram, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetHistogram { | |
const NAME: &'static str = "Browser.getHistogram"; | |
type ReturnObject = GetHistogramReturnObject; | |
} | |
/// Method parameters of the `Browser::getWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
pub type GetWindowBounds = GetWindowBoundsRequest; | |
/// Return object of the `Browser::getWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
pub type GetWindowBoundsReturnObject = GetWindowBoundsResponse; | |
/// Request object of the `Browser::getWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetWindowBoundsRequest { | |
/// Browser window id. | |
pub window_id: WindowID, | |
} | |
/// Response object of the `Browser::getWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetWindowBoundsResponse { | |
/// Bounds information of the window. When window state is 'minimized', the restored window | |
/// position and size are returned. | |
pub bounds: Bounds, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetWindowBounds { | |
const NAME: &'static str = "Browser.getWindowBounds"; | |
type ReturnObject = GetWindowBoundsReturnObject; | |
} | |
/// Method parameters of the `Browser::getWindowForTarget` command. | |
#[cfg(feature = "experimental")] | |
pub type GetWindowForTarget = GetWindowForTargetRequest; | |
/// Return object of the `Browser::getWindowForTarget` command. | |
#[cfg(feature = "experimental")] | |
pub type GetWindowForTargetReturnObject = GetWindowForTargetResponse; | |
/// Request object of the `Browser::getWindowForTarget` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetWindowForTargetRequest { | |
/// Devtools agent host id. If called as a part of the session, associated targetId is used. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub target_id: Option<target::TargetID>, | |
} | |
/// Response object of the `Browser::getWindowForTarget` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetWindowForTargetResponse { | |
/// Browser window id. | |
pub window_id: WindowID, | |
/// Bounds information of the window. When window state is 'minimized', the restored window | |
/// position and size are returned. | |
pub bounds: Bounds, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetWindowForTarget { | |
const NAME: &'static str = "Browser.getWindowForTarget"; | |
type ReturnObject = GetWindowForTargetReturnObject; | |
} | |
/// Method parameters of the `Browser::setWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
pub type SetWindowBounds = SetWindowBoundsRequest; | |
/// Return object of the `Browser::setWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
pub type SetWindowBoundsReturnObject = SetWindowBoundsResponse; | |
/// Request object of the `Browser::setWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetWindowBoundsRequest { | |
/// Browser window id. | |
pub window_id: WindowID, | |
/// New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined | |
/// with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged. | |
pub bounds: Bounds, | |
} | |
/// Response object of the `Browser::setWindowBounds` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetWindowBoundsResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetWindowBounds { | |
const NAME: &'static str = "Browser.setWindowBounds"; | |
type ReturnObject = SetWindowBoundsReturnObject; | |
} | |
/// Method parameters of the `Browser::setDockTile` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDockTile = SetDockTileRequest; | |
/// Return object of the `Browser::setDockTile` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDockTileReturnObject = SetDockTileResponse; | |
/// Request object of the `Browser::setDockTile` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDockTileRequest { | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub badge_label: Option<String>, | |
/// Png encoded image. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub image: Option<Binary>, | |
} | |
/// Response object of the `Browser::setDockTile` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDockTileResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetDockTile { | |
const NAME: &'static str = "Browser.setDockTile"; | |
type ReturnObject = SetDockTileReturnObject; | |
} | |
} | |
/// This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) | |
/// have an associated `id` used in subsequent operations on the related object. Each object type has | |
/// a specific `id` structure, and those are not interchangeable between objects of different kinds. | |
/// CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client | |
/// can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and | |
/// subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "css"))] | |
pub trait CSS: DOM { | |
type Error; | |
/// Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the | |
/// position specified by `location`. | |
fn add_rule(&mut self, style_sheet_id: css::StyleSheetId, rule_text: String, location: css::SourceRange) -> Result<(css::CSSRule), <Self as CSS>::Error>; | |
/// Returns all class names from specified stylesheet. | |
fn collect_class_names(&mut self, style_sheet_id: css::StyleSheetId) -> Result<(Vec<String>), <Self as CSS>::Error>; | |
/// Creates a new special "via-inspector" stylesheet in the frame with given `frameId`. | |
fn create_style_sheet(&mut self, frame_id: page::FrameId) -> Result<(css::StyleSheetId), <Self as CSS>::Error>; | |
/// Disables the CSS agent for the given page. | |
fn disable(&mut self) -> Result<(), <Self as CSS>::Error>; | |
/// Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been | |
/// enabled until the result of this command is received. | |
fn enable(&mut self) -> Result<(), <Self as CSS>::Error>; | |
/// Ensures that the given node will have specified pseudo-classes whenever its style is computed by | |
/// the browser. | |
fn force_pseudo_state(&mut self, node_id: dom::NodeId, forced_pseudo_classes: Vec<String>) -> Result<(), <Self as CSS>::Error>; | |
fn get_background_colors(&mut self, node_id: dom::NodeId) -> Result<(Option<Vec<String>>, Option<String>, Option<String>), <Self as CSS>::Error>; | |
/// Returns the computed style for a DOM node identified by `nodeId`. | |
fn get_computed_style_for_node(&mut self, node_id: dom::NodeId) -> Result<(Vec<css::CSSComputedStyleProperty>), <Self as CSS>::Error>; | |
/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM | |
/// attributes) for a DOM node identified by `nodeId`. | |
fn get_inline_styles_for_node(&mut self, node_id: dom::NodeId) -> Result<(Option<css::CSSStyle>, Option<css::CSSStyle>), <Self as CSS>::Error>; | |
/// Returns requested styles for a DOM node identified by `nodeId`. | |
fn get_matched_styles_for_node(&mut self, node_id: dom::NodeId) -> Result<css::GetMatchedStylesForNodeResponse, <Self as CSS>::Error>; | |
/// Returns all media queries parsed by the rendering engine. | |
fn get_media_queries(&mut self) -> Result<(Vec<css::CSSMedia>), <Self as CSS>::Error>; | |
/// Requests information about platform fonts which we used to render child TextNodes in the given | |
/// node. | |
fn get_platform_fonts_for_node(&mut self, node_id: dom::NodeId) -> Result<(Vec<css::PlatformFontUsage>), <Self as CSS>::Error>; | |
/// Returns the current textual content for a stylesheet. | |
fn get_style_sheet_text(&mut self, style_sheet_id: css::StyleSheetId) -> Result<(String), <Self as CSS>::Error>; | |
/// Find a rule with the given active property for the given node and set the new value for this | |
/// property | |
fn set_effective_property_value_for_node(&mut self, node_id: dom::NodeId, property_name: String, value: String) -> Result<(), <Self as CSS>::Error>; | |
/// Modifies the keyframe rule key text. | |
fn set_keyframe_key(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, key_text: String) -> Result<(css::Value), <Self as CSS>::Error>; | |
/// Modifies the rule selector. | |
fn set_media_text(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, text: String) -> Result<(css::CSSMedia), <Self as CSS>::Error>; | |
/// Modifies the rule selector. | |
fn set_rule_selector(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, selector: String) -> Result<(css::SelectorList), <Self as CSS>::Error>; | |
/// Sets the new stylesheet text. | |
fn set_style_sheet_text(&mut self, style_sheet_id: css::StyleSheetId, text: String) -> Result<(Option<String>), <Self as CSS>::Error>; | |
/// Applies specified style edits one after another in the given order. | |
fn set_style_texts(&mut self, edits: Vec<css::StyleDeclarationEdit>) -> Result<(Vec<css::CSSStyle>), <Self as CSS>::Error>; | |
/// Enables the selector recording. | |
fn start_rule_usage_tracking(&mut self) -> Result<(), <Self as CSS>::Error>; | |
/// Stop tracking rule usage and return the list of rules that were used since last call to | |
/// `takeCoverageDelta` (or since start of coverage instrumentation) | |
fn stop_rule_usage_tracking(&mut self) -> Result<(Vec<css::RuleUsage>), <Self as CSS>::Error>; | |
/// Obtain list of rules that became used since last call to this method (or since start of coverage | |
/// instrumentation) | |
fn take_coverage_delta(&mut self) -> Result<(Vec<css::RuleUsage>), <Self as CSS>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "css"))] | |
impl<T> CSS for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn add_rule(&mut self, style_sheet_id: css::StyleSheetId, rule_text: String, location: css::SourceRange) -> Result<(css::CSSRule), <Self as CSS>::Error> { | |
CallSite::call(self, css::AddRuleRequest { style_sheet_id, rule_text, location }).map(|res| (res.rule)) | |
} | |
fn collect_class_names(&mut self, style_sheet_id: css::StyleSheetId) -> Result<(Vec<String>), <Self as CSS>::Error> { | |
CallSite::call(self, css::CollectClassNamesRequest { style_sheet_id }).map(|res| (res.class_names)) | |
} | |
fn create_style_sheet(&mut self, frame_id: page::FrameId) -> Result<(css::StyleSheetId), <Self as CSS>::Error> { | |
CallSite::call(self, css::CreateStyleSheetRequest { frame_id }).map(|res| (res.style_sheet_id)) | |
} | |
fn disable(&mut self) -> Result<(), <Self as CSS>::Error> { | |
CallSite::call(self, css::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as CSS>::Error> { | |
CallSite::call(self, css::EnableRequest {}).map(|_| ()) | |
} | |
fn force_pseudo_state(&mut self, node_id: dom::NodeId, forced_pseudo_classes: Vec<String>) -> Result<(), <Self as CSS>::Error> { | |
CallSite::call(self, css::ForcePseudoStateRequest { node_id, forced_pseudo_classes }).map(|_| ()) | |
} | |
fn get_background_colors(&mut self, node_id: dom::NodeId) -> Result<(Option<Vec<String>>, Option<String>, Option<String>), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetBackgroundColorsRequest { node_id }).map(|res| (res.background_colors, res.computed_font_size, res.computed_font_weight)) | |
} | |
fn get_computed_style_for_node(&mut self, node_id: dom::NodeId) -> Result<(Vec<css::CSSComputedStyleProperty>), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetComputedStyleForNodeRequest { node_id }).map(|res| (res.computed_style)) | |
} | |
fn get_inline_styles_for_node(&mut self, node_id: dom::NodeId) -> Result<(Option<css::CSSStyle>, Option<css::CSSStyle>), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetInlineStylesForNodeRequest { node_id }).map(|res| (res.inline_style, res.attributes_style)) | |
} | |
fn get_matched_styles_for_node(&mut self, node_id: dom::NodeId) -> Result<css::GetMatchedStylesForNodeResponse, <Self as CSS>::Error> { | |
CallSite::call(self, css::GetMatchedStylesForNodeRequest { node_id }) | |
} | |
fn get_media_queries(&mut self) -> Result<(Vec<css::CSSMedia>), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetMediaQueriesRequest {}).map(|res| (res.medias)) | |
} | |
fn get_platform_fonts_for_node(&mut self, node_id: dom::NodeId) -> Result<(Vec<css::PlatformFontUsage>), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetPlatformFontsForNodeRequest { node_id }).map(|res| (res.fonts)) | |
} | |
fn get_style_sheet_text(&mut self, style_sheet_id: css::StyleSheetId) -> Result<(String), <Self as CSS>::Error> { | |
CallSite::call(self, css::GetStyleSheetTextRequest { style_sheet_id }).map(|res| (res.text)) | |
} | |
fn set_effective_property_value_for_node(&mut self, node_id: dom::NodeId, property_name: String, value: String) -> Result<(), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetEffectivePropertyValueForNodeRequest { node_id, property_name, value }).map(|_| ()) | |
} | |
fn set_keyframe_key(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, key_text: String) -> Result<(css::Value), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetKeyframeKeyRequest { style_sheet_id, range, key_text }).map(|res| (res.key_text)) | |
} | |
fn set_media_text(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, text: String) -> Result<(css::CSSMedia), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetMediaTextRequest { style_sheet_id, range, text }).map(|res| (res.media)) | |
} | |
fn set_rule_selector(&mut self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, selector: String) -> Result<(css::SelectorList), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetRuleSelectorRequest { style_sheet_id, range, selector }).map(|res| (res.selector_list)) | |
} | |
fn set_style_sheet_text(&mut self, style_sheet_id: css::StyleSheetId, text: String) -> Result<(Option<String>), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetStyleSheetTextRequest { style_sheet_id, text }).map(|res| (res.source_map_url)) | |
} | |
fn set_style_texts(&mut self, edits: Vec<css::StyleDeclarationEdit>) -> Result<(Vec<css::CSSStyle>), <Self as CSS>::Error> { | |
CallSite::call(self, css::SetStyleTextsRequest { edits }).map(|res| (res.styles)) | |
} | |
fn start_rule_usage_tracking(&mut self) -> Result<(), <Self as CSS>::Error> { | |
CallSite::call(self, css::StartRuleUsageTrackingRequest {}).map(|_| ()) | |
} | |
fn stop_rule_usage_tracking(&mut self) -> Result<(Vec<css::RuleUsage>), <Self as CSS>::Error> { | |
CallSite::call(self, css::StopRuleUsageTrackingRequest {}).map(|res| (res.rule_usage)) | |
} | |
fn take_coverage_delta(&mut self) -> Result<(Vec<css::RuleUsage>), <Self as CSS>::Error> { | |
CallSite::call(self, css::TakeCoverageDeltaRequest {}).map(|res| (res.coverage)) | |
} | |
} | |
/// This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) | |
/// have an associated `id` used in subsequent operations on the related object. Each object type has | |
/// a specific `id` structure, and those are not interchangeable between objects of different kinds. | |
/// CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client | |
/// can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and | |
/// subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "css")))] | |
pub trait AsyncCSS: AsyncDOM where Self: Sized { | |
type Error; | |
type AddRule: futures::Future<Item = ((css::CSSRule), Self), Error = <Self as AsyncCSS>::Error>; | |
type CollectClassNames: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCSS>::Error>; | |
type CreateStyleSheet: futures::Future<Item = ((css::StyleSheetId), Self), Error = <Self as AsyncCSS>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncCSS>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncCSS>::Error>; | |
type ForcePseudoState: futures::Future<Item = ((), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetBackgroundColors: futures::Future<Item = ((Option<Vec<String>>, Option<String>, Option<String>), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetComputedStyleForNode: futures::Future<Item = ((Vec<css::CSSComputedStyleProperty>), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetInlineStylesForNode: futures::Future<Item = ((Option<css::CSSStyle>, Option<css::CSSStyle>), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetMatchedStylesForNode: futures::Future<Item = (css::GetMatchedStylesForNodeResponse, Self), Error = <Self as AsyncCSS>::Error>; | |
type GetMediaQueries: futures::Future<Item = ((Vec<css::CSSMedia>), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetPlatformFontsForNode: futures::Future<Item = ((Vec<css::PlatformFontUsage>), Self), Error = <Self as AsyncCSS>::Error>; | |
type GetStyleSheetText: futures::Future<Item = ((String), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetEffectivePropertyValueForNode: futures::Future<Item = ((), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetKeyframeKey: futures::Future<Item = ((css::Value), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetMediaText: futures::Future<Item = ((css::CSSMedia), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetRuleSelector: futures::Future<Item = ((css::SelectorList), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetStyleSheetText: futures::Future<Item = ((Option<String>), Self), Error = <Self as AsyncCSS>::Error>; | |
type SetStyleTexts: futures::Future<Item = ((Vec<css::CSSStyle>), Self), Error = <Self as AsyncCSS>::Error>; | |
type StartRuleUsageTracking: futures::Future<Item = ((), Self), Error = <Self as AsyncCSS>::Error>; | |
type StopRuleUsageTracking: futures::Future<Item = ((Vec<css::RuleUsage>), Self), Error = <Self as AsyncCSS>::Error>; | |
type TakeCoverageDelta: futures::Future<Item = ((Vec<css::RuleUsage>), Self), Error = <Self as AsyncCSS>::Error>; | |
/// Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the | |
/// position specified by `location`. | |
fn add_rule(self, style_sheet_id: css::StyleSheetId, rule_text: String, location: css::SourceRange) -> <Self as AsyncCSS>::AddRule; | |
/// Returns all class names from specified stylesheet. | |
fn collect_class_names(self, style_sheet_id: css::StyleSheetId) -> <Self as AsyncCSS>::CollectClassNames; | |
/// Creates a new special "via-inspector" stylesheet in the frame with given `frameId`. | |
fn create_style_sheet(self, frame_id: page::FrameId) -> <Self as AsyncCSS>::CreateStyleSheet; | |
/// Disables the CSS agent for the given page. | |
fn disable(self) -> <Self as AsyncCSS>::Disable; | |
/// Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been | |
/// enabled until the result of this command is received. | |
fn enable(self) -> <Self as AsyncCSS>::Enable; | |
/// Ensures that the given node will have specified pseudo-classes whenever its style is computed by | |
/// the browser. | |
fn force_pseudo_state(self, node_id: dom::NodeId, forced_pseudo_classes: Vec<String>) -> <Self as AsyncCSS>::ForcePseudoState; | |
fn get_background_colors(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetBackgroundColors; | |
/// Returns the computed style for a DOM node identified by `nodeId`. | |
fn get_computed_style_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetComputedStyleForNode; | |
/// Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM | |
/// attributes) for a DOM node identified by `nodeId`. | |
fn get_inline_styles_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetInlineStylesForNode; | |
/// Returns requested styles for a DOM node identified by `nodeId`. | |
fn get_matched_styles_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetMatchedStylesForNode; | |
/// Returns all media queries parsed by the rendering engine. | |
fn get_media_queries(self) -> <Self as AsyncCSS>::GetMediaQueries; | |
/// Requests information about platform fonts which we used to render child TextNodes in the given | |
/// node. | |
fn get_platform_fonts_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetPlatformFontsForNode; | |
/// Returns the current textual content for a stylesheet. | |
fn get_style_sheet_text(self, style_sheet_id: css::StyleSheetId) -> <Self as AsyncCSS>::GetStyleSheetText; | |
/// Find a rule with the given active property for the given node and set the new value for this | |
/// property | |
fn set_effective_property_value_for_node(self, node_id: dom::NodeId, property_name: String, value: String) -> <Self as AsyncCSS>::SetEffectivePropertyValueForNode; | |
/// Modifies the keyframe rule key text. | |
fn set_keyframe_key(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, key_text: String) -> <Self as AsyncCSS>::SetKeyframeKey; | |
/// Modifies the rule selector. | |
fn set_media_text(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, text: String) -> <Self as AsyncCSS>::SetMediaText; | |
/// Modifies the rule selector. | |
fn set_rule_selector(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, selector: String) -> <Self as AsyncCSS>::SetRuleSelector; | |
/// Sets the new stylesheet text. | |
fn set_style_sheet_text(self, style_sheet_id: css::StyleSheetId, text: String) -> <Self as AsyncCSS>::SetStyleSheetText; | |
/// Applies specified style edits one after another in the given order. | |
fn set_style_texts(self, edits: Vec<css::StyleDeclarationEdit>) -> <Self as AsyncCSS>::SetStyleTexts; | |
/// Enables the selector recording. | |
fn start_rule_usage_tracking(self) -> <Self as AsyncCSS>::StartRuleUsageTracking; | |
/// Stop tracking rule usage and return the list of rules that were used since last call to | |
/// `takeCoverageDelta` (or since start of coverage instrumentation) | |
fn stop_rule_usage_tracking(self) -> <Self as AsyncCSS>::StopRuleUsageTracking; | |
/// Obtain list of rules that became used since last call to this method (or since start of coverage | |
/// instrumentation) | |
fn take_coverage_delta(self) -> <Self as AsyncCSS>::TakeCoverageDelta; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "css")))] | |
impl<T> AsyncCSS for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type AddRule = Box<dyn futures::Future<Item = ((css::CSSRule), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CollectClassNames = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CreateStyleSheet = Box<dyn futures::Future<Item = ((css::StyleSheetId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ForcePseudoState = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetBackgroundColors = Box<dyn futures::Future<Item = ((Option<Vec<String>>, Option<String>, Option<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetComputedStyleForNode = Box<dyn futures::Future<Item = ((Vec<css::CSSComputedStyleProperty>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetInlineStylesForNode = Box<dyn futures::Future<Item = ((Option<css::CSSStyle>, Option<css::CSSStyle>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetMatchedStylesForNode = Box<dyn futures::Future<Item = (css::GetMatchedStylesForNodeResponse, Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetMediaQueries = Box<dyn futures::Future<Item = ((Vec<css::CSSMedia>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetPlatformFontsForNode = Box<dyn futures::Future<Item = ((Vec<css::PlatformFontUsage>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetStyleSheetText = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetEffectivePropertyValueForNode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetKeyframeKey = Box<dyn futures::Future<Item = ((css::Value), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetMediaText = Box<dyn futures::Future<Item = ((css::CSSMedia), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetRuleSelector = Box<dyn futures::Future<Item = ((css::SelectorList), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetStyleSheetText = Box<dyn futures::Future<Item = ((Option<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetStyleTexts = Box<dyn futures::Future<Item = ((Vec<css::CSSStyle>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StartRuleUsageTracking = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopRuleUsageTracking = Box<dyn futures::Future<Item = ((Vec<css::RuleUsage>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type TakeCoverageDelta = Box<dyn futures::Future<Item = ((Vec<css::RuleUsage>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn add_rule(self, style_sheet_id: css::StyleSheetId, rule_text: String, location: css::SourceRange) -> <Self as AsyncCSS>::AddRule { | |
Box::new(AsyncCallSite::async_call(self, css::AddRuleRequest { style_sheet_id, rule_text, location }).map(|(res, self_)| ((res.rule), self_))) | |
} | |
fn collect_class_names(self, style_sheet_id: css::StyleSheetId) -> <Self as AsyncCSS>::CollectClassNames { | |
Box::new(AsyncCallSite::async_call(self, css::CollectClassNamesRequest { style_sheet_id }).map(|(res, self_)| ((res.class_names), self_))) | |
} | |
fn create_style_sheet(self, frame_id: page::FrameId) -> <Self as AsyncCSS>::CreateStyleSheet { | |
Box::new(AsyncCallSite::async_call(self, css::CreateStyleSheetRequest { frame_id }).map(|(res, self_)| ((res.style_sheet_id), self_))) | |
} | |
fn disable(self) -> <Self as AsyncCSS>::Disable { | |
Box::new(AsyncCallSite::async_call(self, css::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncCSS>::Enable { | |
Box::new(AsyncCallSite::async_call(self, css::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn force_pseudo_state(self, node_id: dom::NodeId, forced_pseudo_classes: Vec<String>) -> <Self as AsyncCSS>::ForcePseudoState { | |
Box::new(AsyncCallSite::async_call(self, css::ForcePseudoStateRequest { node_id, forced_pseudo_classes }).map(|(_, self_)| ((), self_))) | |
} | |
fn get_background_colors(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetBackgroundColors { | |
Box::new(AsyncCallSite::async_call(self, css::GetBackgroundColorsRequest { node_id }).map(|(res, self_)| ((res.background_colors, res.computed_font_size, res.computed_font_weight), self_))) | |
} | |
fn get_computed_style_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetComputedStyleForNode { | |
Box::new(AsyncCallSite::async_call(self, css::GetComputedStyleForNodeRequest { node_id }).map(|(res, self_)| ((res.computed_style), self_))) | |
} | |
fn get_inline_styles_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetInlineStylesForNode { | |
Box::new(AsyncCallSite::async_call(self, css::GetInlineStylesForNodeRequest { node_id }).map(|(res, self_)| ((res.inline_style, res.attributes_style), self_))) | |
} | |
fn get_matched_styles_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetMatchedStylesForNode { | |
(AsyncCallSite::async_call(self, css::GetMatchedStylesForNodeRequest { node_id })) | |
} | |
fn get_media_queries(self) -> <Self as AsyncCSS>::GetMediaQueries { | |
Box::new(AsyncCallSite::async_call(self, css::GetMediaQueriesRequest {}).map(|(res, self_)| ((res.medias), self_))) | |
} | |
fn get_platform_fonts_for_node(self, node_id: dom::NodeId) -> <Self as AsyncCSS>::GetPlatformFontsForNode { | |
Box::new(AsyncCallSite::async_call(self, css::GetPlatformFontsForNodeRequest { node_id }).map(|(res, self_)| ((res.fonts), self_))) | |
} | |
fn get_style_sheet_text(self, style_sheet_id: css::StyleSheetId) -> <Self as AsyncCSS>::GetStyleSheetText { | |
Box::new(AsyncCallSite::async_call(self, css::GetStyleSheetTextRequest { style_sheet_id }).map(|(res, self_)| ((res.text), self_))) | |
} | |
fn set_effective_property_value_for_node(self, node_id: dom::NodeId, property_name: String, value: String) -> <Self as AsyncCSS>::SetEffectivePropertyValueForNode { | |
Box::new(AsyncCallSite::async_call(self, css::SetEffectivePropertyValueForNodeRequest { node_id, property_name, value }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_keyframe_key(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, key_text: String) -> <Self as AsyncCSS>::SetKeyframeKey { | |
Box::new(AsyncCallSite::async_call(self, css::SetKeyframeKeyRequest { style_sheet_id, range, key_text }).map(|(res, self_)| ((res.key_text), self_))) | |
} | |
fn set_media_text(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, text: String) -> <Self as AsyncCSS>::SetMediaText { | |
Box::new(AsyncCallSite::async_call(self, css::SetMediaTextRequest { style_sheet_id, range, text }).map(|(res, self_)| ((res.media), self_))) | |
} | |
fn set_rule_selector(self, style_sheet_id: css::StyleSheetId, range: css::SourceRange, selector: String) -> <Self as AsyncCSS>::SetRuleSelector { | |
Box::new(AsyncCallSite::async_call(self, css::SetRuleSelectorRequest { style_sheet_id, range, selector }).map(|(res, self_)| ((res.selector_list), self_))) | |
} | |
fn set_style_sheet_text(self, style_sheet_id: css::StyleSheetId, text: String) -> <Self as AsyncCSS>::SetStyleSheetText { | |
Box::new(AsyncCallSite::async_call(self, css::SetStyleSheetTextRequest { style_sheet_id, text }).map(|(res, self_)| ((res.source_map_url), self_))) | |
} | |
fn set_style_texts(self, edits: Vec<css::StyleDeclarationEdit>) -> <Self as AsyncCSS>::SetStyleTexts { | |
Box::new(AsyncCallSite::async_call(self, css::SetStyleTextsRequest { edits }).map(|(res, self_)| ((res.styles), self_))) | |
} | |
fn start_rule_usage_tracking(self) -> <Self as AsyncCSS>::StartRuleUsageTracking { | |
Box::new(AsyncCallSite::async_call(self, css::StartRuleUsageTrackingRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_rule_usage_tracking(self) -> <Self as AsyncCSS>::StopRuleUsageTracking { | |
Box::new(AsyncCallSite::async_call(self, css::StopRuleUsageTrackingRequest {}).map(|(res, self_)| ((res.rule_usage), self_))) | |
} | |
fn take_coverage_delta(self) -> <Self as AsyncCSS>::TakeCoverageDelta { | |
Box::new(AsyncCallSite::async_call(self, css::TakeCoverageDeltaRequest {}).map(|(res, self_)| ((res.coverage), self_))) | |
} | |
} | |
/// This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) | |
/// have an associated `id` used in subsequent operations on the related object. Each object type has | |
/// a specific `id` structure, and those are not interchangeable between objects of different kinds. | |
/// CSS objects can be loaded using the `get*ForNode()` calls (which accept a DOM node id). A client | |
/// can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and | |
/// subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "css"))] | |
#[allow(deprecated)] | |
pub mod css { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
pub type StyleSheetId = String; | |
/// Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent | |
/// stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via | |
/// inspector" rules), "regular" for regular stylesheets. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum StyleSheetOrigin { | |
Injected, | |
UserAgent, | |
Inspector, | |
Regular, | |
} | |
/// CSS rule collection for a single pseudo style. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PseudoElementMatches { | |
/// Pseudo element type. | |
pub pseudo_type: dom::PseudoType, | |
/// Matches of CSS rules applicable to the pseudo style. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub matches: Vec<RuleMatch>, | |
} | |
/// Inherited CSS rule collection from ancestor node. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InheritedStyleEntry { | |
/// The ancestor node's inline style, if any, in the style inheritance chain. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub inline_style: Option<CSSStyle>, | |
/// Matches of CSS rules matching the ancestor node in the style inheritance chain. | |
#[serde(rename = "matchedCSSRules")] | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub matched_css_rules: Vec<RuleMatch>, | |
} | |
/// Match data for a CSS rule. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RuleMatch { | |
/// CSS rule in the match. | |
pub rule: CSSRule, | |
/// Matching selector indices in the rule's selectorList selectors (0-based). | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub matching_selectors: Vec<Integer>, | |
} | |
/// Data for a simple selector (these are delimited by commas in a selector list). | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Value { | |
/// Value text. | |
pub text: String, | |
/// Value range in the underlying resource (if available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub range: Option<SourceRange>, | |
} | |
/// Selector list data. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SelectorList { | |
/// Selectors in the list. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub selectors: Vec<Value>, | |
/// Rule selector text. | |
pub text: String, | |
} | |
/// CSS stylesheet metainformation. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSStyleSheetHeader { | |
/// The stylesheet identifier. | |
pub style_sheet_id: StyleSheetId, | |
/// Owner frame identifier. | |
pub frame_id: page::FrameId, | |
/// Stylesheet resource URL. | |
#[serde(rename = "sourceURL")] | |
pub source_url: String, | |
/// URL of source map associated with the stylesheet (if any). | |
#[serde(rename = "sourceMapURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub source_map_url: Option<String>, | |
/// Stylesheet origin. | |
pub origin: StyleSheetOrigin, | |
/// Stylesheet title. | |
pub title: String, | |
/// The backend id for the owner node of the stylesheet. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub owner_node: Option<dom::BackendNodeId>, | |
/// Denotes whether the stylesheet is disabled. | |
pub disabled: Boolean, | |
/// Whether the sourceURL field value comes from the sourceURL comment. | |
#[serde(rename = "hasSourceURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub has_source_url: Option<Boolean>, | |
/// Whether this stylesheet is created for STYLE tag by parser. This flag is not set for | |
/// document.written STYLE tags. | |
pub is_inline: Boolean, | |
/// Line offset of the stylesheet within the resource (zero based). | |
pub start_line: Number, | |
/// Column offset of the stylesheet within the resource (zero based). | |
pub start_column: Number, | |
/// Size of the content (in characters). | |
pub length: Number, | |
} | |
/// CSS rule representation. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSRule { | |
/// The css style sheet identifier (absent for user agent stylesheet and user-specified | |
/// stylesheet rules) this rule came from. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub style_sheet_id: Option<StyleSheetId>, | |
/// Rule selector data. | |
pub selector_list: SelectorList, | |
/// Parent stylesheet's origin. | |
pub origin: StyleSheetOrigin, | |
/// Associated style declaration. | |
pub style: CSSStyle, | |
/// Media list array (for rules involving media queries). The array enumerates media queries | |
/// starting with the innermost one, going outwards. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub media: Option<Vec<CSSMedia>>, | |
} | |
/// CSS coverage information. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RuleUsage { | |
/// The css style sheet identifier (absent for user agent stylesheet and user-specified | |
/// stylesheet rules) this rule came from. | |
pub style_sheet_id: StyleSheetId, | |
/// Offset of the start of the rule (including selector) from the beginning of the stylesheet. | |
pub start_offset: Number, | |
/// Offset of the end of the rule body from the beginning of the stylesheet. | |
pub end_offset: Number, | |
/// Indicates whether the rule was actually used by some element in the page. | |
pub used: Boolean, | |
} | |
/// Text range within a resource. All numbers are zero-based. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SourceRange { | |
/// Start line of range. | |
pub start_line: Integer, | |
/// Start column of range (inclusive). | |
pub start_column: Integer, | |
/// End line of range | |
pub end_line: Integer, | |
/// End column of range (exclusive). | |
pub end_column: Integer, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ShorthandEntry { | |
/// Shorthand name. | |
pub name: String, | |
/// Shorthand value. | |
pub value: String, | |
/// Whether the property has "!important" annotation (implies `false` if absent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub important: Option<Boolean>, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSComputedStyleProperty { | |
/// Computed style property name. | |
pub name: String, | |
/// Computed style property value. | |
pub value: String, | |
} | |
/// CSS style representation. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSStyle { | |
/// The css style sheet identifier (absent for user agent stylesheet and user-specified | |
/// stylesheet rules) this rule came from. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub style_sheet_id: Option<StyleSheetId>, | |
/// CSS properties in the style. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub css_properties: Vec<CSSProperty>, | |
/// Computed values for all shorthands found in the style. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub shorthand_entries: Vec<ShorthandEntry>, | |
/// Style declaration text (if available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub css_text: Option<String>, | |
/// Style declaration range in the enclosing stylesheet (if available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub range: Option<SourceRange>, | |
} | |
/// CSS property declaration data. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSProperty { | |
/// The property name. | |
pub name: String, | |
/// The property value. | |
pub value: String, | |
/// Whether the property has "!important" annotation (implies `false` if absent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub important: Option<Boolean>, | |
/// Whether the property is implicit (implies `false` if absent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub implicit: Option<Boolean>, | |
/// The full property text as specified in the style. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub text: Option<String>, | |
/// Whether the property is understood by the browser (implies `true` if absent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub parsed_ok: Option<Boolean>, | |
/// Whether the property is disabled by the user (present for source-based properties only). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub disabled: Option<Boolean>, | |
/// The entire property range in the enclosing style declaration (if available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub range: Option<SourceRange>, | |
} | |
/// CSS media rule descriptor. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSMedia { | |
/// Media query text. | |
pub text: String, | |
/// Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if | |
/// specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked | |
/// stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline | |
/// stylesheet's STYLE tag. | |
pub source: CSSMediaSource, | |
/// URL of the document containing the media query description. | |
#[serde(rename = "sourceURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub source_url: Option<String>, | |
/// The associated rule (@media or @import) header range in the enclosing stylesheet (if | |
/// available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub range: Option<SourceRange>, | |
/// Identifier of the stylesheet containing this object (if exists). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub style_sheet_id: Option<StyleSheetId>, | |
/// Array of media queries. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub media_list: Option<Vec<MediaQuery>>, | |
} | |
/// Allow values for the `CSSMedia::source` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CSSMediaSource { | |
MediaRule, | |
ImportRule, | |
LinkedSheet, | |
InlineSheet, | |
} | |
/// Media query descriptor. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MediaQuery { | |
/// Array of media query expressions. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub expressions: Vec<MediaQueryExpression>, | |
/// Whether the media query condition is satisfied. | |
pub active: Boolean, | |
} | |
/// Media query expression descriptor. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MediaQueryExpression { | |
/// Media query expression value. | |
pub value: Number, | |
/// Media query expression units. | |
pub unit: String, | |
/// Media query expression feature. | |
pub feature: String, | |
/// The associated range of the value text in the enclosing stylesheet (if available). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub value_range: Option<SourceRange>, | |
/// Computed length of media query expression (if applicable). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub computed_length: Option<Number>, | |
} | |
/// Information about amount of glyphs that were rendered with given font. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PlatformFontUsage { | |
/// Font's family name reported by platform. | |
pub family_name: String, | |
/// Indicates if the font was downloaded or resolved locally. | |
pub is_custom_font: Boolean, | |
/// Amount of glyphs that were rendered with this font. | |
pub glyph_count: Number, | |
} | |
/// Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FontFace { | |
/// The font-family. | |
pub font_family: String, | |
/// The font-style. | |
pub font_style: String, | |
/// The font-variant. | |
pub font_variant: String, | |
/// The font-weight. | |
pub font_weight: String, | |
/// The font-stretch. | |
pub font_stretch: String, | |
/// The unicode-range. | |
pub unicode_range: String, | |
/// The src. | |
pub src: String, | |
/// The resolved platform font family | |
pub platform_font_family: String, | |
} | |
/// CSS keyframes rule representation. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSKeyframesRule { | |
/// Animation name. | |
pub animation_name: Value, | |
/// List of keyframes. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub keyframes: Vec<CSSKeyframeRule>, | |
} | |
/// CSS keyframe rule representation. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CSSKeyframeRule { | |
/// The css style sheet identifier (absent for user agent stylesheet and user-specified | |
/// stylesheet rules) this rule came from. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub style_sheet_id: Option<StyleSheetId>, | |
/// Parent stylesheet's origin. | |
pub origin: StyleSheetOrigin, | |
/// Associated key text. | |
pub key_text: Value, | |
/// Associated style declaration. | |
pub style: CSSStyle, | |
} | |
/// A descriptor of operation to mutate style declaration text. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StyleDeclarationEdit { | |
/// The css style sheet identifier. | |
pub style_sheet_id: StyleSheetId, | |
/// The range of the style text in the enclosing stylesheet. | |
pub range: SourceRange, | |
/// New style text. | |
pub text: String, | |
} | |
/// Method parameters of the `CSS::addRule` command. | |
pub type AddRule = AddRuleRequest; | |
/// Return object of the `CSS::addRule` command. | |
pub type AddRuleReturnObject = AddRuleResponse; | |
/// Request object of the `CSS::addRule` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddRuleRequest { | |
/// The css style sheet identifier where a new rule should be inserted. | |
pub style_sheet_id: StyleSheetId, | |
/// The text of a new rule. | |
pub rule_text: String, | |
/// Text position of a new rule in the target style sheet. | |
pub location: SourceRange, | |
} | |
/// Response object of the `CSS::addRule` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddRuleResponse { | |
/// The newly created rule. | |
pub rule: CSSRule, | |
} | |
impl Method for AddRule { | |
const NAME: &'static str = "CSS.addRule"; | |
type ReturnObject = AddRuleReturnObject; | |
} | |
/// Method parameters of the `CSS::collectClassNames` command. | |
pub type CollectClassNames = CollectClassNamesRequest; | |
/// Return object of the `CSS::collectClassNames` command. | |
pub type CollectClassNamesReturnObject = CollectClassNamesResponse; | |
/// Request object of the `CSS::collectClassNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CollectClassNamesRequest { | |
pub style_sheet_id: StyleSheetId, | |
} | |
/// Response object of the `CSS::collectClassNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CollectClassNamesResponse { | |
/// Class name list. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub class_names: Vec<String>, | |
} | |
impl Method for CollectClassNames { | |
const NAME: &'static str = "CSS.collectClassNames"; | |
type ReturnObject = CollectClassNamesReturnObject; | |
} | |
/// Method parameters of the `CSS::createStyleSheet` command. | |
pub type CreateStyleSheet = CreateStyleSheetRequest; | |
/// Return object of the `CSS::createStyleSheet` command. | |
pub type CreateStyleSheetReturnObject = CreateStyleSheetResponse; | |
/// Request object of the `CSS::createStyleSheet` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CreateStyleSheetRequest { | |
/// Identifier of the frame where "via-inspector" stylesheet should be created. | |
pub frame_id: page::FrameId, | |
} | |
/// Response object of the `CSS::createStyleSheet` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CreateStyleSheetResponse { | |
/// Identifier of the created "via-inspector" stylesheet. | |
pub style_sheet_id: StyleSheetId, | |
} | |
impl Method for CreateStyleSheet { | |
const NAME: &'static str = "CSS.createStyleSheet"; | |
type ReturnObject = CreateStyleSheetReturnObject; | |
} | |
/// Method parameters of the `CSS::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `CSS::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `CSS::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `CSS::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "CSS.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `CSS::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `CSS::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `CSS::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `CSS::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "CSS.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `CSS::forcePseudoState` command. | |
pub type ForcePseudoState = ForcePseudoStateRequest; | |
/// Return object of the `CSS::forcePseudoState` command. | |
pub type ForcePseudoStateReturnObject = ForcePseudoStateResponse; | |
/// Request object of the `CSS::forcePseudoState` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ForcePseudoStateRequest { | |
/// The element id for which to force the pseudo state. | |
pub node_id: dom::NodeId, | |
/// Element pseudo classes to force when computing the element's style. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub forced_pseudo_classes: Vec<String>, | |
} | |
/// Response object of the `CSS::forcePseudoState` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ForcePseudoStateResponse { | |
} | |
impl Method for ForcePseudoState { | |
const NAME: &'static str = "CSS.forcePseudoState"; | |
type ReturnObject = ForcePseudoStateReturnObject; | |
} | |
/// Method parameters of the `CSS::getBackgroundColors` command. | |
pub type GetBackgroundColors = GetBackgroundColorsRequest; | |
/// Return object of the `CSS::getBackgroundColors` command. | |
pub type GetBackgroundColorsReturnObject = GetBackgroundColorsResponse; | |
/// Request object of the `CSS::getBackgroundColors` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBackgroundColorsRequest { | |
/// Id of the node to get background colors for. | |
pub node_id: dom::NodeId, | |
} | |
/// Response object of the `CSS::getBackgroundColors` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBackgroundColorsResponse { | |
/// The range of background colors behind this element, if it contains any visible text. If no | |
/// visible text is present, this will be undefined. In the case of a flat background color, | |
/// this will consist of simply that color. In the case of a gradient, this will consist of each | |
/// of the color stops. For anything more complicated, this will be an empty array. Images will | |
/// be ignored (as if the image had failed to load). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub background_colors: Option<Vec<String>>, | |
/// The computed font size for this node, as a CSS computed value string (e.g. '12px'). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub computed_font_size: Option<String>, | |
/// The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or | |
/// '100'). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub computed_font_weight: Option<String>, | |
} | |
impl Method for GetBackgroundColors { | |
const NAME: &'static str = "CSS.getBackgroundColors"; | |
type ReturnObject = GetBackgroundColorsReturnObject; | |
} | |
/// Method parameters of the `CSS::getComputedStyleForNode` command. | |
pub type GetComputedStyleForNode = GetComputedStyleForNodeRequest; | |
/// Return object of the `CSS::getComputedStyleForNode` command. | |
pub type GetComputedStyleForNodeReturnObject = GetComputedStyleForNodeResponse; | |
/// Request object of the `CSS::getComputedStyleForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetComputedStyleForNodeRequest { | |
pub node_id: dom::NodeId, | |
} | |
/// Response object of the `CSS::getComputedStyleForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetComputedStyleForNodeResponse { | |
/// Computed style for the specified DOM node. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub computed_style: Vec<CSSComputedStyleProperty>, | |
} | |
impl Method for GetComputedStyleForNode { | |
const NAME: &'static str = "CSS.getComputedStyleForNode"; | |
type ReturnObject = GetComputedStyleForNodeReturnObject; | |
} | |
/// Method parameters of the `CSS::getInlineStylesForNode` command. | |
pub type GetInlineStylesForNode = GetInlineStylesForNodeRequest; | |
/// Return object of the `CSS::getInlineStylesForNode` command. | |
pub type GetInlineStylesForNodeReturnObject = GetInlineStylesForNodeResponse; | |
/// Request object of the `CSS::getInlineStylesForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetInlineStylesForNodeRequest { | |
pub node_id: dom::NodeId, | |
} | |
/// Response object of the `CSS::getInlineStylesForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetInlineStylesForNodeResponse { | |
/// Inline style for the specified DOM node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub inline_style: Option<CSSStyle>, | |
/// Attribute-defined element style (e.g. resulting from "width=20 height=100%"). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attributes_style: Option<CSSStyle>, | |
} | |
impl Method for GetInlineStylesForNode { | |
const NAME: &'static str = "CSS.getInlineStylesForNode"; | |
type ReturnObject = GetInlineStylesForNodeReturnObject; | |
} | |
/// Method parameters of the `CSS::getMatchedStylesForNode` command. | |
pub type GetMatchedStylesForNode = GetMatchedStylesForNodeRequest; | |
/// Return object of the `CSS::getMatchedStylesForNode` command. | |
pub type GetMatchedStylesForNodeReturnObject = GetMatchedStylesForNodeResponse; | |
/// Request object of the `CSS::getMatchedStylesForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMatchedStylesForNodeRequest { | |
pub node_id: dom::NodeId, | |
} | |
/// Response object of the `CSS::getMatchedStylesForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMatchedStylesForNodeResponse { | |
/// Inline style for the specified DOM node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub inline_style: Option<CSSStyle>, | |
/// Attribute-defined element style (e.g. resulting from "width=20 height=100%"). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attributes_style: Option<CSSStyle>, | |
/// CSS rules matching this node, from all applicable stylesheets. | |
#[serde(rename = "matchedCSSRules")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub matched_css_rules: Option<Vec<RuleMatch>>, | |
/// Pseudo style matches for this node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_elements: Option<Vec<PseudoElementMatches>>, | |
/// A chain of inherited styles (from the immediate node parent up to the DOM tree root). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub inherited: Option<Vec<InheritedStyleEntry>>, | |
/// A list of CSS keyframed animations matching this node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub css_keyframes_rules: Option<Vec<CSSKeyframesRule>>, | |
} | |
impl Method for GetMatchedStylesForNode { | |
const NAME: &'static str = "CSS.getMatchedStylesForNode"; | |
type ReturnObject = GetMatchedStylesForNodeReturnObject; | |
} | |
/// Method parameters of the `CSS::getMediaQueries` command. | |
pub type GetMediaQueries = GetMediaQueriesRequest; | |
/// Return object of the `CSS::getMediaQueries` command. | |
pub type GetMediaQueriesReturnObject = GetMediaQueriesResponse; | |
/// Request object of the `CSS::getMediaQueries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMediaQueriesRequest { | |
} | |
/// Response object of the `CSS::getMediaQueries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMediaQueriesResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub medias: Vec<CSSMedia>, | |
} | |
impl Method for GetMediaQueries { | |
const NAME: &'static str = "CSS.getMediaQueries"; | |
type ReturnObject = GetMediaQueriesReturnObject; | |
} | |
/// Method parameters of the `CSS::getPlatformFontsForNode` command. | |
pub type GetPlatformFontsForNode = GetPlatformFontsForNodeRequest; | |
/// Return object of the `CSS::getPlatformFontsForNode` command. | |
pub type GetPlatformFontsForNodeReturnObject = GetPlatformFontsForNodeResponse; | |
/// Request object of the `CSS::getPlatformFontsForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPlatformFontsForNodeRequest { | |
pub node_id: dom::NodeId, | |
} | |
/// Response object of the `CSS::getPlatformFontsForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetPlatformFontsForNodeResponse { | |
/// Usage statistics for every employed platform font. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub fonts: Vec<PlatformFontUsage>, | |
} | |
impl Method for GetPlatformFontsForNode { | |
const NAME: &'static str = "CSS.getPlatformFontsForNode"; | |
type ReturnObject = GetPlatformFontsForNodeReturnObject; | |
} | |
/// Method parameters of the `CSS::getStyleSheetText` command. | |
pub type GetStyleSheetText = GetStyleSheetTextRequest; | |
/// Return object of the `CSS::getStyleSheetText` command. | |
pub type GetStyleSheetTextReturnObject = GetStyleSheetTextResponse; | |
/// Request object of the `CSS::getStyleSheetText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetStyleSheetTextRequest { | |
pub style_sheet_id: StyleSheetId, | |
} | |
/// Response object of the `CSS::getStyleSheetText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetStyleSheetTextResponse { | |
/// The stylesheet text. | |
pub text: String, | |
} | |
impl Method for GetStyleSheetText { | |
const NAME: &'static str = "CSS.getStyleSheetText"; | |
type ReturnObject = GetStyleSheetTextReturnObject; | |
} | |
/// Method parameters of the `CSS::setEffectivePropertyValueForNode` command. | |
pub type SetEffectivePropertyValueForNode = SetEffectivePropertyValueForNodeRequest; | |
/// Return object of the `CSS::setEffectivePropertyValueForNode` command. | |
pub type SetEffectivePropertyValueForNodeReturnObject = SetEffectivePropertyValueForNodeResponse; | |
/// Request object of the `CSS::setEffectivePropertyValueForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEffectivePropertyValueForNodeRequest { | |
/// The element id for which to set property. | |
pub node_id: dom::NodeId, | |
pub property_name: String, | |
pub value: String, | |
} | |
/// Response object of the `CSS::setEffectivePropertyValueForNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEffectivePropertyValueForNodeResponse { | |
} | |
impl Method for SetEffectivePropertyValueForNode { | |
const NAME: &'static str = "CSS.setEffectivePropertyValueForNode"; | |
type ReturnObject = SetEffectivePropertyValueForNodeReturnObject; | |
} | |
/// Method parameters of the `CSS::setKeyframeKey` command. | |
pub type SetKeyframeKey = SetKeyframeKeyRequest; | |
/// Return object of the `CSS::setKeyframeKey` command. | |
pub type SetKeyframeKeyReturnObject = SetKeyframeKeyResponse; | |
/// Request object of the `CSS::setKeyframeKey` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetKeyframeKeyRequest { | |
pub style_sheet_id: StyleSheetId, | |
pub range: SourceRange, | |
pub key_text: String, | |
} | |
/// Response object of the `CSS::setKeyframeKey` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetKeyframeKeyResponse { | |
/// The resulting key text after modification. | |
pub key_text: Value, | |
} | |
impl Method for SetKeyframeKey { | |
const NAME: &'static str = "CSS.setKeyframeKey"; | |
type ReturnObject = SetKeyframeKeyReturnObject; | |
} | |
/// Method parameters of the `CSS::setMediaText` command. | |
pub type SetMediaText = SetMediaTextRequest; | |
/// Return object of the `CSS::setMediaText` command. | |
pub type SetMediaTextReturnObject = SetMediaTextResponse; | |
/// Request object of the `CSS::setMediaText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetMediaTextRequest { | |
pub style_sheet_id: StyleSheetId, | |
pub range: SourceRange, | |
pub text: String, | |
} | |
/// Response object of the `CSS::setMediaText` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetMediaTextResponse { | |
/// The resulting CSS media rule after modification. | |
pub media: CSSMedia, | |
} | |
impl Method for SetMediaText { | |
const NAME: &'static str = "CSS.setMediaText"; | |
type ReturnObject = SetMediaTextReturnObject; | |
} | |
/// Method parameters of the `CSS::setRuleSelector` command. | |
pub type SetRuleSelector = SetRuleSelectorRequest; | |
/// Return object of the `CSS::setRuleSelector` command. | |
pub type SetRuleSelectorReturnObject = SetRuleSelectorResponse; | |
/// Request object of the `CSS::setRuleSelector` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRuleSelectorRequest { | |
pub style_sheet_id: StyleSheetId, | |
pub range: SourceRange, | |
pub selector: String, | |
} | |
/// Response object of the `CSS::setRuleSelector` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRuleSelectorResponse { | |
/// The resulting selector list after modification. | |
pub selector_list: SelectorList, | |
} | |
impl Method for SetRuleSelector { | |
const NAME: &'static str = "CSS.setRuleSelector"; | |
type ReturnObject = SetRuleSelectorReturnObject; | |
} | |
/// Method parameters of the `CSS::setStyleSheetText` command. | |
pub type SetStyleSheetText = SetStyleSheetTextRequest; | |
/// Return object of the `CSS::setStyleSheetText` command. | |
pub type SetStyleSheetTextReturnObject = SetStyleSheetTextResponse; | |
/// Request object of the `CSS::setStyleSheetText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetStyleSheetTextRequest { | |
pub style_sheet_id: StyleSheetId, | |
pub text: String, | |
} | |
/// Response object of the `CSS::setStyleSheetText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetStyleSheetTextResponse { | |
/// URL of source map associated with script (if any). | |
#[serde(rename = "sourceMapURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub source_map_url: Option<String>, | |
} | |
impl Method for SetStyleSheetText { | |
const NAME: &'static str = "CSS.setStyleSheetText"; | |
type ReturnObject = SetStyleSheetTextReturnObject; | |
} | |
/// Method parameters of the `CSS::setStyleTexts` command. | |
pub type SetStyleTexts = SetStyleTextsRequest; | |
/// Return object of the `CSS::setStyleTexts` command. | |
pub type SetStyleTextsReturnObject = SetStyleTextsResponse; | |
/// Request object of the `CSS::setStyleTexts` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetStyleTextsRequest { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub edits: Vec<StyleDeclarationEdit>, | |
} | |
/// Response object of the `CSS::setStyleTexts` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetStyleTextsResponse { | |
/// The resulting styles after modification. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub styles: Vec<CSSStyle>, | |
} | |
impl Method for SetStyleTexts { | |
const NAME: &'static str = "CSS.setStyleTexts"; | |
type ReturnObject = SetStyleTextsReturnObject; | |
} | |
/// Method parameters of the `CSS::startRuleUsageTracking` command. | |
pub type StartRuleUsageTracking = StartRuleUsageTrackingRequest; | |
/// Return object of the `CSS::startRuleUsageTracking` command. | |
pub type StartRuleUsageTrackingReturnObject = StartRuleUsageTrackingResponse; | |
/// Request object of the `CSS::startRuleUsageTracking` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartRuleUsageTrackingRequest { | |
} | |
/// Response object of the `CSS::startRuleUsageTracking` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartRuleUsageTrackingResponse { | |
} | |
impl Method for StartRuleUsageTracking { | |
const NAME: &'static str = "CSS.startRuleUsageTracking"; | |
type ReturnObject = StartRuleUsageTrackingReturnObject; | |
} | |
/// Method parameters of the `CSS::stopRuleUsageTracking` command. | |
pub type StopRuleUsageTracking = StopRuleUsageTrackingRequest; | |
/// Return object of the `CSS::stopRuleUsageTracking` command. | |
pub type StopRuleUsageTrackingReturnObject = StopRuleUsageTrackingResponse; | |
/// Request object of the `CSS::stopRuleUsageTracking` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopRuleUsageTrackingRequest { | |
} | |
/// Response object of the `CSS::stopRuleUsageTracking` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopRuleUsageTrackingResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub rule_usage: Vec<RuleUsage>, | |
} | |
impl Method for StopRuleUsageTracking { | |
const NAME: &'static str = "CSS.stopRuleUsageTracking"; | |
type ReturnObject = StopRuleUsageTrackingReturnObject; | |
} | |
/// Method parameters of the `CSS::takeCoverageDelta` command. | |
pub type TakeCoverageDelta = TakeCoverageDeltaRequest; | |
/// Return object of the `CSS::takeCoverageDelta` command. | |
pub type TakeCoverageDeltaReturnObject = TakeCoverageDeltaResponse; | |
/// Request object of the `CSS::takeCoverageDelta` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TakeCoverageDeltaRequest { | |
} | |
/// Response object of the `CSS::takeCoverageDelta` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TakeCoverageDeltaResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub coverage: Vec<RuleUsage>, | |
} | |
impl Method for TakeCoverageDelta { | |
const NAME: &'static str = "CSS.takeCoverageDelta"; | |
type ReturnObject = TakeCoverageDeltaReturnObject; | |
} | |
/// Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded | |
/// web font | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FontsUpdatedEvent { | |
/// The web font that has loaded. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub font: Option<FontFace>, | |
} | |
/// Fires whenever a MediaQuery result changes (for example, after a browser window has been | |
/// resized.) The current implementation considers only viewport-dependent media features. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MediaQueryResultChangedEvent { | |
} | |
/// Fired whenever an active document stylesheet is added. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StyleSheetAddedEvent { | |
/// Added stylesheet metainfo. | |
pub header: CSSStyleSheetHeader, | |
} | |
/// Fired whenever a stylesheet is changed as a result of the client operation. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StyleSheetChangedEvent { | |
pub style_sheet_id: StyleSheetId, | |
} | |
/// Fired whenever an active document stylesheet is removed. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StyleSheetRemovedEvent { | |
/// Identifier of the removed stylesheet. | |
pub style_sheet_id: StyleSheetId, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded | |
/// web font | |
#[serde(rename = "CSS.fontsUpdated")] | |
FontsUpdated(FontsUpdatedEvent), | |
/// Fires whenever a MediaQuery result changes (for example, after a browser window has been | |
/// resized.) The current implementation considers only viewport-dependent media features. | |
#[serde(rename = "CSS.mediaQueryResultChanged")] | |
MediaQueryResultChanged(MediaQueryResultChangedEvent), | |
/// Fired whenever an active document stylesheet is added. | |
#[serde(rename = "CSS.styleSheetAdded")] | |
StyleSheetAdded(StyleSheetAddedEvent), | |
/// Fired whenever a stylesheet is changed as a result of the client operation. | |
#[serde(rename = "CSS.styleSheetChanged")] | |
StyleSheetChanged(StyleSheetChangedEvent), | |
/// Fired whenever an active document stylesheet is removed. | |
#[serde(rename = "CSS.styleSheetRemoved")] | |
StyleSheetRemoved(StyleSheetRemovedEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cache_storage"))] | |
pub trait CacheStorage { | |
type Error; | |
/// Deletes a cache. | |
fn delete_cache(&mut self, cache_id: cache_storage::CacheId) -> Result<(), <Self as CacheStorage>::Error>; | |
/// Deletes a cache entry. | |
fn delete_entry(&mut self, cache_id: cache_storage::CacheId, request: String) -> Result<(), <Self as CacheStorage>::Error>; | |
/// Requests cache names. | |
fn request_cache_names(&mut self, security_origin: String) -> Result<(Vec<cache_storage::Cache>), <Self as CacheStorage>::Error>; | |
/// Fetches cache entry. | |
fn request_cached_response(&mut self, cache_id: cache_storage::CacheId, request_url: String, request_headers: Vec<cache_storage::Header>) -> Result<(cache_storage::CachedResponse), <Self as CacheStorage>::Error>; | |
/// Requests data from cache. | |
fn request_entries(&mut self, cache_id: cache_storage::CacheId, skip_count: Integer, page_size: Integer, path_filter: Option<String>) -> Result<(Vec<cache_storage::DataEntry>, Number), <Self as CacheStorage>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cache_storage"))] | |
impl<T> CacheStorage for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn delete_cache(&mut self, cache_id: cache_storage::CacheId) -> Result<(), <Self as CacheStorage>::Error> { | |
CallSite::call(self, cache_storage::DeleteCacheRequest { cache_id }).map(|_| ()) | |
} | |
fn delete_entry(&mut self, cache_id: cache_storage::CacheId, request: String) -> Result<(), <Self as CacheStorage>::Error> { | |
CallSite::call(self, cache_storage::DeleteEntryRequest { cache_id, request }).map(|_| ()) | |
} | |
fn request_cache_names(&mut self, security_origin: String) -> Result<(Vec<cache_storage::Cache>), <Self as CacheStorage>::Error> { | |
CallSite::call(self, cache_storage::RequestCacheNamesRequest { security_origin }).map(|res| (res.caches)) | |
} | |
fn request_cached_response(&mut self, cache_id: cache_storage::CacheId, request_url: String, request_headers: Vec<cache_storage::Header>) -> Result<(cache_storage::CachedResponse), <Self as CacheStorage>::Error> { | |
CallSite::call(self, cache_storage::RequestCachedResponseRequest { cache_id, request_url, request_headers }).map(|res| (res.response)) | |
} | |
fn request_entries(&mut self, cache_id: cache_storage::CacheId, skip_count: Integer, page_size: Integer, path_filter: Option<String>) -> Result<(Vec<cache_storage::DataEntry>, Number), <Self as CacheStorage>::Error> { | |
CallSite::call(self, cache_storage::RequestEntriesRequest { cache_id, skip_count, page_size, path_filter }).map(|res| (res.cache_data_entries, res.return_count)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "cache_storage")))] | |
pub trait AsyncCacheStorage where Self: Sized { | |
type Error; | |
type DeleteCache: futures::Future<Item = ((), Self), Error = <Self as AsyncCacheStorage>::Error>; | |
type DeleteEntry: futures::Future<Item = ((), Self), Error = <Self as AsyncCacheStorage>::Error>; | |
type RequestCacheNames: futures::Future<Item = ((Vec<cache_storage::Cache>), Self), Error = <Self as AsyncCacheStorage>::Error>; | |
type RequestCachedResponse: futures::Future<Item = ((cache_storage::CachedResponse), Self), Error = <Self as AsyncCacheStorage>::Error>; | |
type RequestEntries: futures::Future<Item = ((Vec<cache_storage::DataEntry>, Number), Self), Error = <Self as AsyncCacheStorage>::Error>; | |
/// Deletes a cache. | |
fn delete_cache(self, cache_id: cache_storage::CacheId) -> <Self as AsyncCacheStorage>::DeleteCache; | |
/// Deletes a cache entry. | |
fn delete_entry(self, cache_id: cache_storage::CacheId, request: String) -> <Self as AsyncCacheStorage>::DeleteEntry; | |
/// Requests cache names. | |
fn request_cache_names(self, security_origin: String) -> <Self as AsyncCacheStorage>::RequestCacheNames; | |
/// Fetches cache entry. | |
fn request_cached_response(self, cache_id: cache_storage::CacheId, request_url: String, request_headers: Vec<cache_storage::Header>) -> <Self as AsyncCacheStorage>::RequestCachedResponse; | |
/// Requests data from cache. | |
fn request_entries(self, cache_id: cache_storage::CacheId, skip_count: Integer, page_size: Integer, path_filter: Option<String>) -> <Self as AsyncCacheStorage>::RequestEntries; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "cache_storage")))] | |
impl<T> AsyncCacheStorage for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type DeleteCache = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DeleteEntry = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestCacheNames = Box<dyn futures::Future<Item = ((Vec<cache_storage::Cache>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestCachedResponse = Box<dyn futures::Future<Item = ((cache_storage::CachedResponse), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestEntries = Box<dyn futures::Future<Item = ((Vec<cache_storage::DataEntry>, Number), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn delete_cache(self, cache_id: cache_storage::CacheId) -> <Self as AsyncCacheStorage>::DeleteCache { | |
Box::new(AsyncCallSite::async_call(self, cache_storage::DeleteCacheRequest { cache_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn delete_entry(self, cache_id: cache_storage::CacheId, request: String) -> <Self as AsyncCacheStorage>::DeleteEntry { | |
Box::new(AsyncCallSite::async_call(self, cache_storage::DeleteEntryRequest { cache_id, request }).map(|(_, self_)| ((), self_))) | |
} | |
fn request_cache_names(self, security_origin: String) -> <Self as AsyncCacheStorage>::RequestCacheNames { | |
Box::new(AsyncCallSite::async_call(self, cache_storage::RequestCacheNamesRequest { security_origin }).map(|(res, self_)| ((res.caches), self_))) | |
} | |
fn request_cached_response(self, cache_id: cache_storage::CacheId, request_url: String, request_headers: Vec<cache_storage::Header>) -> <Self as AsyncCacheStorage>::RequestCachedResponse { | |
Box::new(AsyncCallSite::async_call(self, cache_storage::RequestCachedResponseRequest { cache_id, request_url, request_headers }).map(|(res, self_)| ((res.response), self_))) | |
} | |
fn request_entries(self, cache_id: cache_storage::CacheId, skip_count: Integer, page_size: Integer, path_filter: Option<String>) -> <Self as AsyncCacheStorage>::RequestEntries { | |
Box::new(AsyncCallSite::async_call(self, cache_storage::RequestEntriesRequest { cache_id, skip_count, page_size, path_filter }).map(|(res, self_)| ((res.cache_data_entries, res.return_count), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cache_storage"))] | |
#[allow(deprecated)] | |
pub mod cache_storage { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique identifier of the Cache object. | |
pub type CacheId = String; | |
/// type of HTTP response cached | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CachedResponseType { | |
Basic, | |
Cors, | |
Default, | |
Error, | |
OpaqueResponse, | |
OpaqueRedirect, | |
} | |
/// Data entry. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DataEntry { | |
/// Request URL. | |
#[serde(rename = "requestURL")] | |
pub request_url: String, | |
/// Request method. | |
pub request_method: String, | |
/// Request headers | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub request_headers: Vec<Header>, | |
/// Number of seconds since epoch. | |
pub response_time: Number, | |
/// HTTP response status code. | |
pub response_status: Integer, | |
/// HTTP response status text. | |
pub response_status_text: String, | |
/// HTTP response type | |
pub response_type: CachedResponseType, | |
/// Response headers | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub response_headers: Vec<Header>, | |
} | |
/// Cache identifier. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Cache { | |
/// An opaque unique id of the cache. | |
pub cache_id: CacheId, | |
/// Security origin of the cache. | |
pub security_origin: String, | |
/// The name of the cache. | |
pub cache_name: String, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Header { | |
pub name: String, | |
pub value: String, | |
} | |
/// Cached response | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CachedResponse { | |
/// Entry content, base64-encoded. | |
pub body: Binary, | |
} | |
/// Method parameters of the `CacheStorage::deleteCache` command. | |
pub type DeleteCache = DeleteCacheRequest; | |
/// Return object of the `CacheStorage::deleteCache` command. | |
pub type DeleteCacheReturnObject = DeleteCacheResponse; | |
/// Request object of the `CacheStorage::deleteCache` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCacheRequest { | |
/// Id of cache for deletion. | |
pub cache_id: CacheId, | |
} | |
/// Response object of the `CacheStorage::deleteCache` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCacheResponse { | |
} | |
impl Method for DeleteCache { | |
const NAME: &'static str = "CacheStorage.deleteCache"; | |
type ReturnObject = DeleteCacheReturnObject; | |
} | |
/// Method parameters of the `CacheStorage::deleteEntry` command. | |
pub type DeleteEntry = DeleteEntryRequest; | |
/// Return object of the `CacheStorage::deleteEntry` command. | |
pub type DeleteEntryReturnObject = DeleteEntryResponse; | |
/// Request object of the `CacheStorage::deleteEntry` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteEntryRequest { | |
/// Id of cache where the entry will be deleted. | |
pub cache_id: CacheId, | |
/// URL spec of the request. | |
pub request: String, | |
} | |
/// Response object of the `CacheStorage::deleteEntry` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteEntryResponse { | |
} | |
impl Method for DeleteEntry { | |
const NAME: &'static str = "CacheStorage.deleteEntry"; | |
type ReturnObject = DeleteEntryReturnObject; | |
} | |
/// Method parameters of the `CacheStorage::requestCacheNames` command. | |
pub type RequestCacheNames = RequestCacheNamesRequest; | |
/// Return object of the `CacheStorage::requestCacheNames` command. | |
pub type RequestCacheNamesReturnObject = RequestCacheNamesResponse; | |
/// Request object of the `CacheStorage::requestCacheNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestCacheNamesRequest { | |
/// Security origin. | |
pub security_origin: String, | |
} | |
/// Response object of the `CacheStorage::requestCacheNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestCacheNamesResponse { | |
/// Caches for the security origin. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub caches: Vec<Cache>, | |
} | |
impl Method for RequestCacheNames { | |
const NAME: &'static str = "CacheStorage.requestCacheNames"; | |
type ReturnObject = RequestCacheNamesReturnObject; | |
} | |
/// Method parameters of the `CacheStorage::requestCachedResponse` command. | |
pub type RequestCachedResponse = RequestCachedResponseRequest; | |
/// Return object of the `CacheStorage::requestCachedResponse` command. | |
pub type RequestCachedResponseReturnObject = RequestCachedResponseResponse; | |
/// Request object of the `CacheStorage::requestCachedResponse` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestCachedResponseRequest { | |
/// Id of cache that contains the entry. | |
pub cache_id: CacheId, | |
/// URL spec of the request. | |
#[serde(rename = "requestURL")] | |
pub request_url: String, | |
/// headers of the request. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub request_headers: Vec<Header>, | |
} | |
/// Response object of the `CacheStorage::requestCachedResponse` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestCachedResponseResponse { | |
/// Response read from the cache. | |
pub response: CachedResponse, | |
} | |
impl Method for RequestCachedResponse { | |
const NAME: &'static str = "CacheStorage.requestCachedResponse"; | |
type ReturnObject = RequestCachedResponseReturnObject; | |
} | |
/// Method parameters of the `CacheStorage::requestEntries` command. | |
pub type RequestEntries = RequestEntriesRequest; | |
/// Return object of the `CacheStorage::requestEntries` command. | |
pub type RequestEntriesReturnObject = RequestEntriesResponse; | |
/// Request object of the `CacheStorage::requestEntries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestEntriesRequest { | |
/// ID of cache to get entries from. | |
pub cache_id: CacheId, | |
/// Number of records to skip. | |
pub skip_count: Integer, | |
/// Number of records to fetch. | |
pub page_size: Integer, | |
/// If present, only return the entries containing this substring in the path | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub path_filter: Option<String>, | |
} | |
/// Response object of the `CacheStorage::requestEntries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestEntriesResponse { | |
/// Array of object store data entries. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub cache_data_entries: Vec<DataEntry>, | |
/// Count of returned entries from this storage. If pathFilter is empty, it | |
/// is the count of all entries from this storage. | |
pub return_count: Number, | |
} | |
impl Method for RequestEntries { | |
const NAME: &'static str = "CacheStorage.requestEntries"; | |
type ReturnObject = RequestEntriesReturnObject; | |
} | |
} | |
/// A domain for interacting with Cast, Presentation API, and Remote Playback API | |
/// functionalities. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cast"))] | |
pub trait Cast { | |
type Error; | |
/// Starts observing for sinks that can be used for tab mirroring, and if set, | |
/// sinks compatible with |presentationUrl| as well. When sinks are found, a | |
/// |sinksUpdated| event is fired. | |
/// Also starts observing for issue messages. When an issue is added or removed, | |
/// an |issueUpdated| event is fired. | |
fn enable(&mut self, presentation_url: Option<String>) -> Result<(), <Self as Cast>::Error>; | |
/// Stops observing for sinks and issues. | |
fn disable(&mut self) -> Result<(), <Self as Cast>::Error>; | |
/// Sets a sink to be used when the web page requests the browser to choose a | |
/// sink via Presentation API, Remote Playback API, or Cast SDK. | |
fn set_sink_to_use(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error>; | |
/// Starts mirroring the tab to the sink. | |
fn start_tab_mirroring(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error>; | |
/// Stops the active Cast session on the sink. | |
fn stop_casting(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cast"))] | |
impl<T> Cast for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn enable(&mut self, presentation_url: Option<String>) -> Result<(), <Self as Cast>::Error> { | |
CallSite::call(self, cast::EnableRequest { presentation_url }).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as Cast>::Error> { | |
CallSite::call(self, cast::DisableRequest {}).map(|_| ()) | |
} | |
fn set_sink_to_use(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error> { | |
CallSite::call(self, cast::SetSinkToUseRequest { sink_name }).map(|_| ()) | |
} | |
fn start_tab_mirroring(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error> { | |
CallSite::call(self, cast::StartTabMirroringRequest { sink_name }).map(|_| ()) | |
} | |
fn stop_casting(&mut self, sink_name: String) -> Result<(), <Self as Cast>::Error> { | |
CallSite::call(self, cast::StopCastingRequest { sink_name }).map(|_| ()) | |
} | |
} | |
/// A domain for interacting with Cast, Presentation API, and Remote Playback API | |
/// functionalities. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "cast")))] | |
pub trait AsyncCast where Self: Sized { | |
type Error; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncCast>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncCast>::Error>; | |
type SetSinkToUse: futures::Future<Item = ((), Self), Error = <Self as AsyncCast>::Error>; | |
type StartTabMirroring: futures::Future<Item = ((), Self), Error = <Self as AsyncCast>::Error>; | |
type StopCasting: futures::Future<Item = ((), Self), Error = <Self as AsyncCast>::Error>; | |
/// Starts observing for sinks that can be used for tab mirroring, and if set, | |
/// sinks compatible with |presentationUrl| as well. When sinks are found, a | |
/// |sinksUpdated| event is fired. | |
/// Also starts observing for issue messages. When an issue is added or removed, | |
/// an |issueUpdated| event is fired. | |
fn enable(self, presentation_url: Option<String>) -> <Self as AsyncCast>::Enable; | |
/// Stops observing for sinks and issues. | |
fn disable(self) -> <Self as AsyncCast>::Disable; | |
/// Sets a sink to be used when the web page requests the browser to choose a | |
/// sink via Presentation API, Remote Playback API, or Cast SDK. | |
fn set_sink_to_use(self, sink_name: String) -> <Self as AsyncCast>::SetSinkToUse; | |
/// Starts mirroring the tab to the sink. | |
fn start_tab_mirroring(self, sink_name: String) -> <Self as AsyncCast>::StartTabMirroring; | |
/// Stops the active Cast session on the sink. | |
fn stop_casting(self, sink_name: String) -> <Self as AsyncCast>::StopCasting; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "cast")))] | |
impl<T> AsyncCast for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetSinkToUse = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StartTabMirroring = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopCasting = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn enable(self, presentation_url: Option<String>) -> <Self as AsyncCast>::Enable { | |
Box::new(AsyncCallSite::async_call(self, cast::EnableRequest { presentation_url }).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncCast>::Disable { | |
Box::new(AsyncCallSite::async_call(self, cast::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn set_sink_to_use(self, sink_name: String) -> <Self as AsyncCast>::SetSinkToUse { | |
Box::new(AsyncCallSite::async_call(self, cast::SetSinkToUseRequest { sink_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn start_tab_mirroring(self, sink_name: String) -> <Self as AsyncCast>::StartTabMirroring { | |
Box::new(AsyncCallSite::async_call(self, cast::StartTabMirroringRequest { sink_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_casting(self, sink_name: String) -> <Self as AsyncCast>::StopCasting { | |
Box::new(AsyncCallSite::async_call(self, cast::StopCastingRequest { sink_name }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// A domain for interacting with Cast, Presentation API, and Remote Playback API | |
/// functionalities. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "cast"))] | |
#[allow(deprecated)] | |
pub mod cast { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Sink { | |
pub name: String, | |
pub id: String, | |
/// Text describing the current session. Present only if there is an active | |
/// session on the sink. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub session: Option<String>, | |
} | |
/// Method parameters of the `Cast::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Cast::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Cast::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub presentation_url: Option<String>, | |
} | |
/// Response object of the `Cast::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Cast.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Cast::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Cast::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Cast::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Cast::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Cast.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Cast::setSinkToUse` command. | |
pub type SetSinkToUse = SetSinkToUseRequest; | |
/// Return object of the `Cast::setSinkToUse` command. | |
pub type SetSinkToUseReturnObject = SetSinkToUseResponse; | |
/// Request object of the `Cast::setSinkToUse` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetSinkToUseRequest { | |
pub sink_name: String, | |
} | |
/// Response object of the `Cast::setSinkToUse` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetSinkToUseResponse { | |
} | |
impl Method for SetSinkToUse { | |
const NAME: &'static str = "Cast.setSinkToUse"; | |
type ReturnObject = SetSinkToUseReturnObject; | |
} | |
/// Method parameters of the `Cast::startTabMirroring` command. | |
pub type StartTabMirroring = StartTabMirroringRequest; | |
/// Return object of the `Cast::startTabMirroring` command. | |
pub type StartTabMirroringReturnObject = StartTabMirroringResponse; | |
/// Request object of the `Cast::startTabMirroring` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartTabMirroringRequest { | |
pub sink_name: String, | |
} | |
/// Response object of the `Cast::startTabMirroring` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartTabMirroringResponse { | |
} | |
impl Method for StartTabMirroring { | |
const NAME: &'static str = "Cast.startTabMirroring"; | |
type ReturnObject = StartTabMirroringReturnObject; | |
} | |
/// Method parameters of the `Cast::stopCasting` command. | |
pub type StopCasting = StopCastingRequest; | |
/// Return object of the `Cast::stopCasting` command. | |
pub type StopCastingReturnObject = StopCastingResponse; | |
/// Request object of the `Cast::stopCasting` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopCastingRequest { | |
pub sink_name: String, | |
} | |
/// Response object of the `Cast::stopCasting` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopCastingResponse { | |
} | |
impl Method for StopCasting { | |
const NAME: &'static str = "Cast.stopCasting"; | |
type ReturnObject = StopCastingReturnObject; | |
} | |
/// This is fired whenever the list of available sinks changes. A sink is a | |
/// device or a software surface that you can cast to. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SinksUpdatedEvent { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub sinks: Vec<Sink>, | |
} | |
/// This is fired whenever the outstanding issue/error message changes. | |
/// |issueMessage| is empty if there is no issue. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct IssueUpdatedEvent { | |
pub issue_message: String, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// This is fired whenever the list of available sinks changes. A sink is a | |
/// device or a software surface that you can cast to. | |
#[serde(rename = "Cast.sinksUpdated")] | |
SinksUpdated(SinksUpdatedEvent), | |
/// This is fired whenever the outstanding issue/error message changes. | |
/// |issueMessage| is empty if there is no issue. | |
#[serde(rename = "Cast.issueUpdated")] | |
IssueUpdated(IssueUpdatedEvent), | |
} | |
} | |
/// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object | |
/// that has an `id`. This `id` can be used to get additional information on the Node, resolve it into | |
/// the JavaScript object wrapper, etc. It is important that client receives DOM events only for the | |
/// nodes that are known to the client. Backend keeps track of the nodes that were sent to the client | |
/// and never sends the same node twice. It is client's responsibility to collect information about | |
/// the nodes that were sent to the client.<p>Note that `iframe` owner elements will return | |
/// corresponding document elements as their child nodes.</p> | |
#[cfg(any(feature = "all", feature = "dom"))] | |
pub trait DOM: Runtime { | |
type Error; | |
/// Collects class names for the node with given id and all of it's child nodes. | |
#[cfg(feature = "experimental")] | |
fn collect_class_names_from_subtree(&mut self, node_id: dom::NodeId) -> Result<(Vec<String>), <Self as DOM>::Error>; | |
/// Creates a deep copy of the specified node and places it into the target container before the | |
/// given anchor. | |
#[cfg(feature = "experimental")] | |
fn copy_to(&mut self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Describes node given its id, does not require domain to be enabled. Does not start tracking any | |
/// objects, can be used for automation. | |
fn describe_node(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(dom::Node), <Self as DOM>::Error>; | |
/// Disables DOM agent for the given page. | |
fn disable(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Discards search results from the session with the given id. `getSearchResults` should no longer | |
/// be called for that search. | |
#[cfg(feature = "experimental")] | |
fn discard_search_results(&mut self, search_id: String) -> Result<(), <Self as DOM>::Error>; | |
/// Enables DOM agent for the given page. | |
fn enable(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Focuses the given element. | |
fn focus(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(), <Self as DOM>::Error>; | |
/// Returns attributes for the specified node. | |
fn get_attributes(&mut self, node_id: dom::NodeId) -> Result<(Vec<String>), <Self as DOM>::Error>; | |
/// Returns boxes for the given node. | |
fn get_box_model(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(dom::BoxModel), <Self as DOM>::Error>; | |
/// Returns quads that describe node position on the page. This method | |
/// might return multiple quads for inline nodes. | |
#[cfg(feature = "experimental")] | |
fn get_content_quads(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(Vec<dom::Quad>), <Self as DOM>::Error>; | |
/// Returns the root DOM node (and optionally the subtree) to the caller. | |
fn get_document(&mut self, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(dom::Node), <Self as DOM>::Error>; | |
/// Returns the root DOM node (and optionally the subtree) to the caller. | |
fn get_flattened_document(&mut self, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(Vec<dom::Node>), <Self as DOM>::Error>; | |
/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is | |
/// either returned or not. | |
#[cfg(feature = "experimental")] | |
fn get_node_for_location(&mut self, x: Integer, y: Integer, include_user_agent_shadow_dom: Option<Boolean>) -> Result<(dom::BackendNodeId, Option<dom::NodeId>), <Self as DOM>::Error>; | |
/// Returns node's HTML markup. | |
fn get_outer_html(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(String), <Self as DOM>::Error>; | |
/// Returns the id of the nearest ancestor that is a relayout boundary. | |
#[cfg(feature = "experimental")] | |
fn get_relayout_boundary(&mut self, node_id: dom::NodeId) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Returns search results from given `fromIndex` to given `toIndex` from the search with the given | |
/// identifier. | |
#[cfg(feature = "experimental")] | |
fn get_search_results(&mut self, search_id: String, from_index: Integer, to_index: Integer) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error>; | |
/// Hides any highlight. | |
fn hide_highlight(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Highlights DOM node. | |
fn highlight_node(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Highlights given rectangle. | |
fn highlight_rect(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Marks last undoable state. | |
#[cfg(feature = "experimental")] | |
fn mark_undoable_state(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Moves node into the new container, places it before the given anchor. | |
fn move_to(&mut self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or | |
/// `cancelSearch` to end this search session. | |
#[cfg(feature = "experimental")] | |
fn perform_search(&mut self, query: String, include_user_agent_shadow_dom: Option<Boolean>) -> Result<(String, Integer), <Self as DOM>::Error>; | |
/// Requests that the node is sent to the caller given its path. // FIXME, use XPath | |
#[cfg(feature = "experimental")] | |
fn push_node_by_path_to_frontend(&mut self, path: String) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Requests that a batch of nodes is sent to the caller given their backend node ids. | |
#[cfg(feature = "experimental")] | |
fn push_nodes_by_backend_ids_to_frontend(&mut self, backend_node_ids: Vec<dom::BackendNodeId>) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error>; | |
/// Executes `querySelector` on a given node. | |
fn query_selector(&mut self, node_id: dom::NodeId, selector: String) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Executes `querySelectorAll` on a given node. | |
fn query_selector_all(&mut self, node_id: dom::NodeId, selector: String) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error>; | |
/// Re-does the last undone action. | |
#[cfg(feature = "experimental")] | |
fn redo(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Removes attribute with given name from an element with given id. | |
fn remove_attribute(&mut self, node_id: dom::NodeId, name: String) -> Result<(), <Self as DOM>::Error>; | |
/// Removes node with given id. | |
fn remove_node(&mut self, node_id: dom::NodeId) -> Result<(), <Self as DOM>::Error>; | |
/// Requests that children of the node with given id are returned to the caller in form of | |
/// `setChildNodes` events where not only immediate children are retrieved, but all children down to | |
/// the specified depth. | |
fn request_child_nodes(&mut self, node_id: dom::NodeId, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(), <Self as DOM>::Error>; | |
/// Requests that the node is sent to the caller given the JavaScript node object reference. All | |
/// nodes that form the path from the node to the root are also sent to the client as a series of | |
/// `setChildNodes` notifications. | |
fn request_node(&mut self, object_id: runtime::RemoteObjectId) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Resolves the JavaScript node object for a given NodeId or BackendNodeId. | |
fn resolve_node(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_group: Option<String>, execution_context_id: Option<runtime::ExecutionContextId>) -> Result<(runtime::RemoteObject), <Self as DOM>::Error>; | |
/// Sets attribute for an element with given id. | |
fn set_attribute_value(&mut self, node_id: dom::NodeId, name: String, value: String) -> Result<(), <Self as DOM>::Error>; | |
/// Sets attributes on element with given id. This method is useful when user edits some existing | |
/// attribute value and types in several attribute name/value pairs. | |
fn set_attributes_as_text(&mut self, node_id: dom::NodeId, text: String, name: Option<String>) -> Result<(), <Self as DOM>::Error>; | |
/// Sets files for the given file input element. | |
fn set_file_input_files(&mut self, files: Vec<String>, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(), <Self as DOM>::Error>; | |
/// Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled. | |
#[cfg(feature = "experimental")] | |
fn set_node_stack_traces_enabled(&mut self, enable: Boolean) -> Result<(), <Self as DOM>::Error>; | |
/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. | |
#[cfg(feature = "experimental")] | |
fn get_node_stack_traces(&mut self, node_id: dom::NodeId) -> Result<(Option<runtime::StackTrace>), <Self as DOM>::Error>; | |
/// Returns file information for the given | |
/// File wrapper. | |
#[cfg(feature = "experimental")] | |
fn get_file_info(&mut self, object_id: runtime::RemoteObjectId) -> Result<(String), <Self as DOM>::Error>; | |
/// Enables console to refer to the node with given id via $x (see Command Line API for more details | |
/// $x functions). | |
#[cfg(feature = "experimental")] | |
fn set_inspected_node(&mut self, node_id: dom::NodeId) -> Result<(), <Self as DOM>::Error>; | |
/// Sets node name for a node with given id. | |
fn set_node_name(&mut self, node_id: dom::NodeId, name: String) -> Result<(dom::NodeId), <Self as DOM>::Error>; | |
/// Sets node value for a node with given id. | |
fn set_node_value(&mut self, node_id: dom::NodeId, value: String) -> Result<(), <Self as DOM>::Error>; | |
/// Sets node HTML markup, returns new node id. | |
fn set_outer_html(&mut self, node_id: dom::NodeId, outer_html: String) -> Result<(), <Self as DOM>::Error>; | |
/// Undoes the last performed action. | |
#[cfg(feature = "experimental")] | |
fn undo(&mut self) -> Result<(), <Self as DOM>::Error>; | |
/// Returns iframe node that owns iframe with the given domain. | |
#[cfg(feature = "experimental")] | |
fn get_frame_owner(&mut self, frame_id: page::FrameId) -> Result<(dom::BackendNodeId, Option<dom::NodeId>), <Self as DOM>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "dom"))] | |
impl<T> DOM for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
#[cfg(feature = "experimental")] | |
fn collect_class_names_from_subtree(&mut self, node_id: dom::NodeId) -> Result<(Vec<String>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::CollectClassNamesFromSubtreeRequest { node_id }).map(|res| (res.class_names)) | |
} | |
#[cfg(feature = "experimental")] | |
fn copy_to(&mut self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::CopyToRequest { node_id, target_node_id, insert_before_node_id }).map(|res| (res.node_id)) | |
} | |
fn describe_node(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(dom::Node), <Self as DOM>::Error> { | |
CallSite::call(self, dom::DescribeNodeRequest { node_id, backend_node_id, object_id, depth, pierce }).map(|res| (res.node)) | |
} | |
fn disable(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::DisableRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn discard_search_results(&mut self, search_id: String) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::DiscardSearchResultsRequest { search_id }).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::EnableRequest {}).map(|_| ()) | |
} | |
fn focus(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::FocusRequest { node_id, backend_node_id, object_id }).map(|_| ()) | |
} | |
fn get_attributes(&mut self, node_id: dom::NodeId) -> Result<(Vec<String>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetAttributesRequest { node_id }).map(|res| (res.attributes)) | |
} | |
fn get_box_model(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(dom::BoxModel), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetBoxModelRequest { node_id, backend_node_id, object_id }).map(|res| (res.model)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_content_quads(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(Vec<dom::Quad>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetContentQuadsRequest { node_id, backend_node_id, object_id }).map(|res| (res.quads)) | |
} | |
fn get_document(&mut self, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(dom::Node), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetDocumentRequest { depth, pierce }).map(|res| (res.root)) | |
} | |
fn get_flattened_document(&mut self, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(Vec<dom::Node>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetFlattenedDocumentRequest { depth, pierce }).map(|res| (res.nodes)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_node_for_location(&mut self, x: Integer, y: Integer, include_user_agent_shadow_dom: Option<Boolean>) -> Result<(dom::BackendNodeId, Option<dom::NodeId>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetNodeForLocationRequest { x, y, include_user_agent_shadow_dom }).map(|res| (res.backend_node_id, res.node_id)) | |
} | |
fn get_outer_html(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(String), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetOuterHTMLRequest { node_id, backend_node_id, object_id }).map(|res| (res.outer_html)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_relayout_boundary(&mut self, node_id: dom::NodeId) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetRelayoutBoundaryRequest { node_id }).map(|res| (res.node_id)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_search_results(&mut self, search_id: String, from_index: Integer, to_index: Integer) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetSearchResultsRequest { search_id, from_index, to_index }).map(|res| (res.node_ids)) | |
} | |
fn hide_highlight(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::HideHighlightRequest {}).map(|_| ()) | |
} | |
fn highlight_node(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::HighlightNodeRequest {}).map(|_| ()) | |
} | |
fn highlight_rect(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::HighlightRectRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn mark_undoable_state(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::MarkUndoableStateRequest {}).map(|_| ()) | |
} | |
fn move_to(&mut self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::MoveToRequest { node_id, target_node_id, insert_before_node_id }).map(|res| (res.node_id)) | |
} | |
#[cfg(feature = "experimental")] | |
fn perform_search(&mut self, query: String, include_user_agent_shadow_dom: Option<Boolean>) -> Result<(String, Integer), <Self as DOM>::Error> { | |
CallSite::call(self, dom::PerformSearchRequest { query, include_user_agent_shadow_dom }).map(|res| (res.search_id, res.result_count)) | |
} | |
#[cfg(feature = "experimental")] | |
fn push_node_by_path_to_frontend(&mut self, path: String) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::PushNodeByPathToFrontendRequest { path }).map(|res| (res.node_id)) | |
} | |
#[cfg(feature = "experimental")] | |
fn push_nodes_by_backend_ids_to_frontend(&mut self, backend_node_ids: Vec<dom::BackendNodeId>) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::PushNodesByBackendIdsToFrontendRequest { backend_node_ids }).map(|res| (res.node_ids)) | |
} | |
fn query_selector(&mut self, node_id: dom::NodeId, selector: String) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::QuerySelectorRequest { node_id, selector }).map(|res| (res.node_id)) | |
} | |
fn query_selector_all(&mut self, node_id: dom::NodeId, selector: String) -> Result<(Vec<dom::NodeId>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::QuerySelectorAllRequest { node_id, selector }).map(|res| (res.node_ids)) | |
} | |
#[cfg(feature = "experimental")] | |
fn redo(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::RedoRequest {}).map(|_| ()) | |
} | |
fn remove_attribute(&mut self, node_id: dom::NodeId, name: String) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::RemoveAttributeRequest { node_id, name }).map(|_| ()) | |
} | |
fn remove_node(&mut self, node_id: dom::NodeId) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::RemoveNodeRequest { node_id }).map(|_| ()) | |
} | |
fn request_child_nodes(&mut self, node_id: dom::NodeId, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::RequestChildNodesRequest { node_id, depth, pierce }).map(|_| ()) | |
} | |
fn request_node(&mut self, object_id: runtime::RemoteObjectId) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::RequestNodeRequest { object_id }).map(|res| (res.node_id)) | |
} | |
fn resolve_node(&mut self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_group: Option<String>, execution_context_id: Option<runtime::ExecutionContextId>) -> Result<(runtime::RemoteObject), <Self as DOM>::Error> { | |
CallSite::call(self, dom::ResolveNodeRequest { node_id, backend_node_id, object_group, execution_context_id }).map(|res| (res.object)) | |
} | |
fn set_attribute_value(&mut self, node_id: dom::NodeId, name: String, value: String) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetAttributeValueRequest { node_id, name, value }).map(|_| ()) | |
} | |
fn set_attributes_as_text(&mut self, node_id: dom::NodeId, text: String, name: Option<String>) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetAttributesAsTextRequest { node_id, text, name }).map(|_| ()) | |
} | |
fn set_file_input_files(&mut self, files: Vec<String>, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetFileInputFilesRequest { files, node_id, backend_node_id, object_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_node_stack_traces_enabled(&mut self, enable: Boolean) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetNodeStackTracesEnabledRequest { enable }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_node_stack_traces(&mut self, node_id: dom::NodeId) -> Result<(Option<runtime::StackTrace>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetNodeStackTracesRequest { node_id }).map(|res| (res.creation)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_file_info(&mut self, object_id: runtime::RemoteObjectId) -> Result<(String), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetFileInfoRequest { object_id }).map(|res| (res.path)) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_inspected_node(&mut self, node_id: dom::NodeId) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetInspectedNodeRequest { node_id }).map(|_| ()) | |
} | |
fn set_node_name(&mut self, node_id: dom::NodeId, name: String) -> Result<(dom::NodeId), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetNodeNameRequest { node_id, name }).map(|res| (res.node_id)) | |
} | |
fn set_node_value(&mut self, node_id: dom::NodeId, value: String) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetNodeValueRequest { node_id, value }).map(|_| ()) | |
} | |
fn set_outer_html(&mut self, node_id: dom::NodeId, outer_html: String) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::SetOuterHTMLRequest { node_id, outer_html }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn undo(&mut self) -> Result<(), <Self as DOM>::Error> { | |
CallSite::call(self, dom::UndoRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_frame_owner(&mut self, frame_id: page::FrameId) -> Result<(dom::BackendNodeId, Option<dom::NodeId>), <Self as DOM>::Error> { | |
CallSite::call(self, dom::GetFrameOwnerRequest { frame_id }).map(|res| (res.backend_node_id, res.node_id)) | |
} | |
} | |
/// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object | |
/// that has an `id`. This `id` can be used to get additional information on the Node, resolve it into | |
/// the JavaScript object wrapper, etc. It is important that client receives DOM events only for the | |
/// nodes that are known to the client. Backend keeps track of the nodes that were sent to the client | |
/// and never sends the same node twice. It is client's responsibility to collect information about | |
/// the nodes that were sent to the client.<p>Note that `iframe` owner elements will return | |
/// corresponding document elements as their child nodes.</p> | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom")))] | |
pub trait AsyncDOM: AsyncRuntime where Self: Sized { | |
type Error; | |
#[cfg(feature = "experimental")] | |
type CollectClassNamesFromSubtree: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type CopyTo: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
type DescribeNode: futures::Future<Item = ((dom::Node), Self), Error = <Self as AsyncDOM>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type DiscardSearchResults: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type Focus: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type GetAttributes: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncDOM>::Error>; | |
type GetBoxModel: futures::Future<Item = ((dom::BoxModel), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetContentQuads: futures::Future<Item = ((Vec<dom::Quad>), Self), Error = <Self as AsyncDOM>::Error>; | |
type GetDocument: futures::Future<Item = ((dom::Node), Self), Error = <Self as AsyncDOM>::Error>; | |
type GetFlattenedDocument: futures::Future<Item = ((Vec<dom::Node>), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetNodeForLocation: futures::Future<Item = ((dom::BackendNodeId, Option<dom::NodeId>), Self), Error = <Self as AsyncDOM>::Error>; | |
type GetOuterHTML: futures::Future<Item = ((String), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetRelayoutBoundary: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetSearchResults: futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncDOM>::Error>; | |
type HideHighlight: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type HighlightNode: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type HighlightRect: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type MarkUndoableState: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type MoveTo: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type PerformSearch: futures::Future<Item = ((String, Integer), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type PushNodeByPathToFrontend: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type PushNodesByBackendIdsToFrontend: futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncDOM>::Error>; | |
type QuerySelector: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
type QuerySelectorAll: futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type Redo: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type RemoveAttribute: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type RemoveNode: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type RequestChildNodes: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type RequestNode: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
type ResolveNode: futures::Future<Item = ((runtime::RemoteObject), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetAttributeValue: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetAttributesAsText: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetFileInputFiles: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetNodeStackTracesEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetNodeStackTraces: futures::Future<Item = ((Option<runtime::StackTrace>), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetFileInfo: futures::Future<Item = ((String), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetInspectedNode: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetNodeName: futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetNodeValue: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
type SetOuterHTML: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type Undo: futures::Future<Item = ((), Self), Error = <Self as AsyncDOM>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetFrameOwner: futures::Future<Item = ((dom::BackendNodeId, Option<dom::NodeId>), Self), Error = <Self as AsyncDOM>::Error>; | |
/// Collects class names for the node with given id and all of it's child nodes. | |
#[cfg(feature = "experimental")] | |
fn collect_class_names_from_subtree(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::CollectClassNamesFromSubtree; | |
/// Creates a deep copy of the specified node and places it into the target container before the | |
/// given anchor. | |
#[cfg(feature = "experimental")] | |
fn copy_to(self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> <Self as AsyncDOM>::CopyTo; | |
/// Describes node given its id, does not require domain to be enabled. Does not start tracking any | |
/// objects, can be used for automation. | |
fn describe_node(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::DescribeNode; | |
/// Disables DOM agent for the given page. | |
fn disable(self) -> <Self as AsyncDOM>::Disable; | |
/// Discards search results from the session with the given id. `getSearchResults` should no longer | |
/// be called for that search. | |
#[cfg(feature = "experimental")] | |
fn discard_search_results(self, search_id: String) -> <Self as AsyncDOM>::DiscardSearchResults; | |
/// Enables DOM agent for the given page. | |
fn enable(self) -> <Self as AsyncDOM>::Enable; | |
/// Focuses the given element. | |
fn focus(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::Focus; | |
/// Returns attributes for the specified node. | |
fn get_attributes(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetAttributes; | |
/// Returns boxes for the given node. | |
fn get_box_model(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetBoxModel; | |
/// Returns quads that describe node position on the page. This method | |
/// might return multiple quads for inline nodes. | |
#[cfg(feature = "experimental")] | |
fn get_content_quads(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetContentQuads; | |
/// Returns the root DOM node (and optionally the subtree) to the caller. | |
fn get_document(self, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::GetDocument; | |
/// Returns the root DOM node (and optionally the subtree) to the caller. | |
fn get_flattened_document(self, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::GetFlattenedDocument; | |
/// Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is | |
/// either returned or not. | |
#[cfg(feature = "experimental")] | |
fn get_node_for_location(self, x: Integer, y: Integer, include_user_agent_shadow_dom: Option<Boolean>) -> <Self as AsyncDOM>::GetNodeForLocation; | |
/// Returns node's HTML markup. | |
fn get_outer_html(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetOuterHTML; | |
/// Returns the id of the nearest ancestor that is a relayout boundary. | |
#[cfg(feature = "experimental")] | |
fn get_relayout_boundary(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetRelayoutBoundary; | |
/// Returns search results from given `fromIndex` to given `toIndex` from the search with the given | |
/// identifier. | |
#[cfg(feature = "experimental")] | |
fn get_search_results(self, search_id: String, from_index: Integer, to_index: Integer) -> <Self as AsyncDOM>::GetSearchResults; | |
/// Hides any highlight. | |
fn hide_highlight(self) -> <Self as AsyncDOM>::HideHighlight; | |
/// Highlights DOM node. | |
fn highlight_node(self) -> <Self as AsyncDOM>::HighlightNode; | |
/// Highlights given rectangle. | |
fn highlight_rect(self) -> <Self as AsyncDOM>::HighlightRect; | |
/// Marks last undoable state. | |
#[cfg(feature = "experimental")] | |
fn mark_undoable_state(self) -> <Self as AsyncDOM>::MarkUndoableState; | |
/// Moves node into the new container, places it before the given anchor. | |
fn move_to(self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> <Self as AsyncDOM>::MoveTo; | |
/// Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or | |
/// `cancelSearch` to end this search session. | |
#[cfg(feature = "experimental")] | |
fn perform_search(self, query: String, include_user_agent_shadow_dom: Option<Boolean>) -> <Self as AsyncDOM>::PerformSearch; | |
/// Requests that the node is sent to the caller given its path. // FIXME, use XPath | |
#[cfg(feature = "experimental")] | |
fn push_node_by_path_to_frontend(self, path: String) -> <Self as AsyncDOM>::PushNodeByPathToFrontend; | |
/// Requests that a batch of nodes is sent to the caller given their backend node ids. | |
#[cfg(feature = "experimental")] | |
fn push_nodes_by_backend_ids_to_frontend(self, backend_node_ids: Vec<dom::BackendNodeId>) -> <Self as AsyncDOM>::PushNodesByBackendIdsToFrontend; | |
/// Executes `querySelector` on a given node. | |
fn query_selector(self, node_id: dom::NodeId, selector: String) -> <Self as AsyncDOM>::QuerySelector; | |
/// Executes `querySelectorAll` on a given node. | |
fn query_selector_all(self, node_id: dom::NodeId, selector: String) -> <Self as AsyncDOM>::QuerySelectorAll; | |
/// Re-does the last undone action. | |
#[cfg(feature = "experimental")] | |
fn redo(self) -> <Self as AsyncDOM>::Redo; | |
/// Removes attribute with given name from an element with given id. | |
fn remove_attribute(self, node_id: dom::NodeId, name: String) -> <Self as AsyncDOM>::RemoveAttribute; | |
/// Removes node with given id. | |
fn remove_node(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::RemoveNode; | |
/// Requests that children of the node with given id are returned to the caller in form of | |
/// `setChildNodes` events where not only immediate children are retrieved, but all children down to | |
/// the specified depth. | |
fn request_child_nodes(self, node_id: dom::NodeId, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::RequestChildNodes; | |
/// Requests that the node is sent to the caller given the JavaScript node object reference. All | |
/// nodes that form the path from the node to the root are also sent to the client as a series of | |
/// `setChildNodes` notifications. | |
fn request_node(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncDOM>::RequestNode; | |
/// Resolves the JavaScript node object for a given NodeId or BackendNodeId. | |
fn resolve_node(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_group: Option<String>, execution_context_id: Option<runtime::ExecutionContextId>) -> <Self as AsyncDOM>::ResolveNode; | |
/// Sets attribute for an element with given id. | |
fn set_attribute_value(self, node_id: dom::NodeId, name: String, value: String) -> <Self as AsyncDOM>::SetAttributeValue; | |
/// Sets attributes on element with given id. This method is useful when user edits some existing | |
/// attribute value and types in several attribute name/value pairs. | |
fn set_attributes_as_text(self, node_id: dom::NodeId, text: String, name: Option<String>) -> <Self as AsyncDOM>::SetAttributesAsText; | |
/// Sets files for the given file input element. | |
fn set_file_input_files(self, files: Vec<String>, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::SetFileInputFiles; | |
/// Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled. | |
#[cfg(feature = "experimental")] | |
fn set_node_stack_traces_enabled(self, enable: Boolean) -> <Self as AsyncDOM>::SetNodeStackTracesEnabled; | |
/// Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. | |
#[cfg(feature = "experimental")] | |
fn get_node_stack_traces(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetNodeStackTraces; | |
/// Returns file information for the given | |
/// File wrapper. | |
#[cfg(feature = "experimental")] | |
fn get_file_info(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncDOM>::GetFileInfo; | |
/// Enables console to refer to the node with given id via $x (see Command Line API for more details | |
/// $x functions). | |
#[cfg(feature = "experimental")] | |
fn set_inspected_node(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::SetInspectedNode; | |
/// Sets node name for a node with given id. | |
fn set_node_name(self, node_id: dom::NodeId, name: String) -> <Self as AsyncDOM>::SetNodeName; | |
/// Sets node value for a node with given id. | |
fn set_node_value(self, node_id: dom::NodeId, value: String) -> <Self as AsyncDOM>::SetNodeValue; | |
/// Sets node HTML markup, returns new node id. | |
fn set_outer_html(self, node_id: dom::NodeId, outer_html: String) -> <Self as AsyncDOM>::SetOuterHTML; | |
/// Undoes the last performed action. | |
#[cfg(feature = "experimental")] | |
fn undo(self) -> <Self as AsyncDOM>::Undo; | |
/// Returns iframe node that owns iframe with the given domain. | |
#[cfg(feature = "experimental")] | |
fn get_frame_owner(self, frame_id: page::FrameId) -> <Self as AsyncDOM>::GetFrameOwner; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom")))] | |
impl<T> AsyncDOM for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
#[cfg(feature = "experimental")] | |
type CollectClassNamesFromSubtree = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type CopyTo = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DescribeNode = Box<dyn futures::Future<Item = ((dom::Node), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type DiscardSearchResults = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Focus = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetAttributes = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetBoxModel = Box<dyn futures::Future<Item = ((dom::BoxModel), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetContentQuads = Box<dyn futures::Future<Item = ((Vec<dom::Quad>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetDocument = Box<dyn futures::Future<Item = ((dom::Node), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetFlattenedDocument = Box<dyn futures::Future<Item = ((Vec<dom::Node>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetNodeForLocation = Box<dyn futures::Future<Item = ((dom::BackendNodeId, Option<dom::NodeId>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetOuterHTML = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetRelayoutBoundary = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetSearchResults = Box<dyn futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HideHighlight = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightNode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightRect = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type MarkUndoableState = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type MoveTo = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type PerformSearch = Box<dyn futures::Future<Item = ((String, Integer), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type PushNodeByPathToFrontend = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type PushNodesByBackendIdsToFrontend = Box<dyn futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type QuerySelector = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type QuerySelectorAll = Box<dyn futures::Future<Item = ((Vec<dom::NodeId>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type Redo = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveAttribute = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveNode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestChildNodes = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestNode = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ResolveNode = Box<dyn futures::Future<Item = ((runtime::RemoteObject), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetAttributeValue = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetAttributesAsText = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetFileInputFiles = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetNodeStackTracesEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetNodeStackTraces = Box<dyn futures::Future<Item = ((Option<runtime::StackTrace>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetFileInfo = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetInspectedNode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetNodeName = Box<dyn futures::Future<Item = ((dom::NodeId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetNodeValue = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetOuterHTML = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type Undo = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetFrameOwner = Box<dyn futures::Future<Item = ((dom::BackendNodeId, Option<dom::NodeId>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
fn collect_class_names_from_subtree(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::CollectClassNamesFromSubtree { | |
Box::new(AsyncCallSite::async_call(self, dom::CollectClassNamesFromSubtreeRequest { node_id }).map(|(res, self_)| ((res.class_names), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn copy_to(self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> <Self as AsyncDOM>::CopyTo { | |
Box::new(AsyncCallSite::async_call(self, dom::CopyToRequest { node_id, target_node_id, insert_before_node_id }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
fn describe_node(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::DescribeNode { | |
Box::new(AsyncCallSite::async_call(self, dom::DescribeNodeRequest { node_id, backend_node_id, object_id, depth, pierce }).map(|(res, self_)| ((res.node), self_))) | |
} | |
fn disable(self) -> <Self as AsyncDOM>::Disable { | |
Box::new(AsyncCallSite::async_call(self, dom::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn discard_search_results(self, search_id: String) -> <Self as AsyncDOM>::DiscardSearchResults { | |
Box::new(AsyncCallSite::async_call(self, dom::DiscardSearchResultsRequest { search_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncDOM>::Enable { | |
Box::new(AsyncCallSite::async_call(self, dom::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn focus(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::Focus { | |
Box::new(AsyncCallSite::async_call(self, dom::FocusRequest { node_id, backend_node_id, object_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn get_attributes(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetAttributes { | |
Box::new(AsyncCallSite::async_call(self, dom::GetAttributesRequest { node_id }).map(|(res, self_)| ((res.attributes), self_))) | |
} | |
fn get_box_model(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetBoxModel { | |
Box::new(AsyncCallSite::async_call(self, dom::GetBoxModelRequest { node_id, backend_node_id, object_id }).map(|(res, self_)| ((res.model), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_content_quads(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetContentQuads { | |
Box::new(AsyncCallSite::async_call(self, dom::GetContentQuadsRequest { node_id, backend_node_id, object_id }).map(|(res, self_)| ((res.quads), self_))) | |
} | |
fn get_document(self, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::GetDocument { | |
Box::new(AsyncCallSite::async_call(self, dom::GetDocumentRequest { depth, pierce }).map(|(res, self_)| ((res.root), self_))) | |
} | |
fn get_flattened_document(self, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::GetFlattenedDocument { | |
Box::new(AsyncCallSite::async_call(self, dom::GetFlattenedDocumentRequest { depth, pierce }).map(|(res, self_)| ((res.nodes), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_node_for_location(self, x: Integer, y: Integer, include_user_agent_shadow_dom: Option<Boolean>) -> <Self as AsyncDOM>::GetNodeForLocation { | |
Box::new(AsyncCallSite::async_call(self, dom::GetNodeForLocationRequest { x, y, include_user_agent_shadow_dom }).map(|(res, self_)| ((res.backend_node_id, res.node_id), self_))) | |
} | |
fn get_outer_html(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::GetOuterHTML { | |
Box::new(AsyncCallSite::async_call(self, dom::GetOuterHTMLRequest { node_id, backend_node_id, object_id }).map(|(res, self_)| ((res.outer_html), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_relayout_boundary(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetRelayoutBoundary { | |
Box::new(AsyncCallSite::async_call(self, dom::GetRelayoutBoundaryRequest { node_id }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_search_results(self, search_id: String, from_index: Integer, to_index: Integer) -> <Self as AsyncDOM>::GetSearchResults { | |
Box::new(AsyncCallSite::async_call(self, dom::GetSearchResultsRequest { search_id, from_index, to_index }).map(|(res, self_)| ((res.node_ids), self_))) | |
} | |
fn hide_highlight(self) -> <Self as AsyncDOM>::HideHighlight { | |
Box::new(AsyncCallSite::async_call(self, dom::HideHighlightRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_node(self) -> <Self as AsyncDOM>::HighlightNode { | |
Box::new(AsyncCallSite::async_call(self, dom::HighlightNodeRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_rect(self) -> <Self as AsyncDOM>::HighlightRect { | |
Box::new(AsyncCallSite::async_call(self, dom::HighlightRectRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn mark_undoable_state(self) -> <Self as AsyncDOM>::MarkUndoableState { | |
Box::new(AsyncCallSite::async_call(self, dom::MarkUndoableStateRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn move_to(self, node_id: dom::NodeId, target_node_id: dom::NodeId, insert_before_node_id: Option<dom::NodeId>) -> <Self as AsyncDOM>::MoveTo { | |
Box::new(AsyncCallSite::async_call(self, dom::MoveToRequest { node_id, target_node_id, insert_before_node_id }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn perform_search(self, query: String, include_user_agent_shadow_dom: Option<Boolean>) -> <Self as AsyncDOM>::PerformSearch { | |
Box::new(AsyncCallSite::async_call(self, dom::PerformSearchRequest { query, include_user_agent_shadow_dom }).map(|(res, self_)| ((res.search_id, res.result_count), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn push_node_by_path_to_frontend(self, path: String) -> <Self as AsyncDOM>::PushNodeByPathToFrontend { | |
Box::new(AsyncCallSite::async_call(self, dom::PushNodeByPathToFrontendRequest { path }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn push_nodes_by_backend_ids_to_frontend(self, backend_node_ids: Vec<dom::BackendNodeId>) -> <Self as AsyncDOM>::PushNodesByBackendIdsToFrontend { | |
Box::new(AsyncCallSite::async_call(self, dom::PushNodesByBackendIdsToFrontendRequest { backend_node_ids }).map(|(res, self_)| ((res.node_ids), self_))) | |
} | |
fn query_selector(self, node_id: dom::NodeId, selector: String) -> <Self as AsyncDOM>::QuerySelector { | |
Box::new(AsyncCallSite::async_call(self, dom::QuerySelectorRequest { node_id, selector }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
fn query_selector_all(self, node_id: dom::NodeId, selector: String) -> <Self as AsyncDOM>::QuerySelectorAll { | |
Box::new(AsyncCallSite::async_call(self, dom::QuerySelectorAllRequest { node_id, selector }).map(|(res, self_)| ((res.node_ids), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn redo(self) -> <Self as AsyncDOM>::Redo { | |
Box::new(AsyncCallSite::async_call(self, dom::RedoRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn remove_attribute(self, node_id: dom::NodeId, name: String) -> <Self as AsyncDOM>::RemoveAttribute { | |
Box::new(AsyncCallSite::async_call(self, dom::RemoveAttributeRequest { node_id, name }).map(|(_, self_)| ((), self_))) | |
} | |
fn remove_node(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::RemoveNode { | |
Box::new(AsyncCallSite::async_call(self, dom::RemoveNodeRequest { node_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn request_child_nodes(self, node_id: dom::NodeId, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOM>::RequestChildNodes { | |
Box::new(AsyncCallSite::async_call(self, dom::RequestChildNodesRequest { node_id, depth, pierce }).map(|(_, self_)| ((), self_))) | |
} | |
fn request_node(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncDOM>::RequestNode { | |
Box::new(AsyncCallSite::async_call(self, dom::RequestNodeRequest { object_id }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
fn resolve_node(self, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_group: Option<String>, execution_context_id: Option<runtime::ExecutionContextId>) -> <Self as AsyncDOM>::ResolveNode { | |
Box::new(AsyncCallSite::async_call(self, dom::ResolveNodeRequest { node_id, backend_node_id, object_group, execution_context_id }).map(|(res, self_)| ((res.object), self_))) | |
} | |
fn set_attribute_value(self, node_id: dom::NodeId, name: String, value: String) -> <Self as AsyncDOM>::SetAttributeValue { | |
Box::new(AsyncCallSite::async_call(self, dom::SetAttributeValueRequest { node_id, name, value }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_attributes_as_text(self, node_id: dom::NodeId, text: String, name: Option<String>) -> <Self as AsyncDOM>::SetAttributesAsText { | |
Box::new(AsyncCallSite::async_call(self, dom::SetAttributesAsTextRequest { node_id, text, name }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_file_input_files(self, files: Vec<String>, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>) -> <Self as AsyncDOM>::SetFileInputFiles { | |
Box::new(AsyncCallSite::async_call(self, dom::SetFileInputFilesRequest { files, node_id, backend_node_id, object_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_node_stack_traces_enabled(self, enable: Boolean) -> <Self as AsyncDOM>::SetNodeStackTracesEnabled { | |
Box::new(AsyncCallSite::async_call(self, dom::SetNodeStackTracesEnabledRequest { enable }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_node_stack_traces(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::GetNodeStackTraces { | |
Box::new(AsyncCallSite::async_call(self, dom::GetNodeStackTracesRequest { node_id }).map(|(res, self_)| ((res.creation), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_file_info(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncDOM>::GetFileInfo { | |
Box::new(AsyncCallSite::async_call(self, dom::GetFileInfoRequest { object_id }).map(|(res, self_)| ((res.path), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_inspected_node(self, node_id: dom::NodeId) -> <Self as AsyncDOM>::SetInspectedNode { | |
Box::new(AsyncCallSite::async_call(self, dom::SetInspectedNodeRequest { node_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_node_name(self, node_id: dom::NodeId, name: String) -> <Self as AsyncDOM>::SetNodeName { | |
Box::new(AsyncCallSite::async_call(self, dom::SetNodeNameRequest { node_id, name }).map(|(res, self_)| ((res.node_id), self_))) | |
} | |
fn set_node_value(self, node_id: dom::NodeId, value: String) -> <Self as AsyncDOM>::SetNodeValue { | |
Box::new(AsyncCallSite::async_call(self, dom::SetNodeValueRequest { node_id, value }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_outer_html(self, node_id: dom::NodeId, outer_html: String) -> <Self as AsyncDOM>::SetOuterHTML { | |
Box::new(AsyncCallSite::async_call(self, dom::SetOuterHTMLRequest { node_id, outer_html }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn undo(self) -> <Self as AsyncDOM>::Undo { | |
Box::new(AsyncCallSite::async_call(self, dom::UndoRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_frame_owner(self, frame_id: page::FrameId) -> <Self as AsyncDOM>::GetFrameOwner { | |
Box::new(AsyncCallSite::async_call(self, dom::GetFrameOwnerRequest { frame_id }).map(|(res, self_)| ((res.backend_node_id, res.node_id), self_))) | |
} | |
} | |
/// This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object | |
/// that has an `id`. This `id` can be used to get additional information on the Node, resolve it into | |
/// the JavaScript object wrapper, etc. It is important that client receives DOM events only for the | |
/// nodes that are known to the client. Backend keeps track of the nodes that were sent to the client | |
/// and never sends the same node twice. It is client's responsibility to collect information about | |
/// the nodes that were sent to the client.<p>Note that `iframe` owner elements will return | |
/// corresponding document elements as their child nodes.</p> | |
#[cfg(any(feature = "all", feature = "dom"))] | |
#[allow(deprecated)] | |
pub mod dom { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique DOM node identifier. | |
pub type NodeId = Integer; | |
/// Unique DOM node identifier used to reference a node that may not have been pushed to the | |
/// front-end. | |
pub type BackendNodeId = Integer; | |
/// Backend node with a friendly name. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BackendNode { | |
/// `Node`'s nodeType. | |
pub node_type: Integer, | |
/// `Node`'s nodeName. | |
pub node_name: String, | |
pub backend_node_id: BackendNodeId, | |
} | |
/// Pseudo element type. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum PseudoType { | |
FirstLine, | |
FirstLetter, | |
Before, | |
After, | |
Backdrop, | |
Selection, | |
FirstLineInherited, | |
Scrollbar, | |
ScrollbarThumb, | |
ScrollbarButton, | |
ScrollbarTrack, | |
ScrollbarTrackPiece, | |
ScrollbarCorner, | |
Resizer, | |
InputListButton, | |
} | |
/// Shadow root type. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ShadowRootType { | |
UserAgent, | |
Open, | |
Closed, | |
} | |
/// DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. | |
/// DOMNode is a base node mirror type. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Node { | |
/// Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend | |
/// will only push node with given `id` once. It is aware of all requested nodes and will only | |
/// fire DOM events for nodes known to the client. | |
pub node_id: NodeId, | |
/// The id of the parent node if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub parent_id: Option<NodeId>, | |
/// The BackendNodeId for this node. | |
pub backend_node_id: BackendNodeId, | |
/// `Node`'s nodeType. | |
pub node_type: Integer, | |
/// `Node`'s nodeName. | |
pub node_name: String, | |
/// `Node`'s localName. | |
pub local_name: String, | |
/// `Node`'s nodeValue. | |
pub node_value: String, | |
/// Child count for `Container` nodes. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub child_node_count: Option<Integer>, | |
/// Child nodes of this node when requested with children. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub children: Option<Vec<Node>>, | |
/// Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attributes: Option<Vec<String>>, | |
/// Document URL that `Document` or `FrameOwner` node points to. | |
#[serde(rename = "documentURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub document_url: Option<String>, | |
/// Base URL that `Document` or `FrameOwner` node uses for URL completion. | |
#[serde(rename = "baseURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub base_url: Option<String>, | |
/// `DocumentType`'s publicId. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub public_id: Option<String>, | |
/// `DocumentType`'s systemId. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub system_id: Option<String>, | |
/// `DocumentType`'s internalSubset. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub internal_subset: Option<String>, | |
/// `Document`'s XML version in case of XML documents. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub xml_version: Option<String>, | |
/// `Attr`'s name. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub name: Option<String>, | |
/// `Attr`'s value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub value: Option<String>, | |
/// Pseudo element type for this node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_type: Option<PseudoType>, | |
/// Shadow root type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shadow_root_type: Option<ShadowRootType>, | |
/// Frame ID for frame owner elements. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_id: Option<page::FrameId>, | |
/// Content document for frame owner elements. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_document: Option<Box<Node>>, | |
/// Shadow root list for given element host. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shadow_roots: Option<Vec<Node>>, | |
/// Content document fragment for template elements. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub template_content: Option<Box<Node>>, | |
/// Pseudo elements associated with this node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_elements: Option<Vec<Node>>, | |
/// Import document for the HTMLImport links. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub imported_document: Option<Box<Node>>, | |
/// Distributed nodes for given insertion point. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub distributed_nodes: Option<Vec<BackendNode>>, | |
/// Whether the node is SVG. | |
#[serde(rename = "isSVG")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_svg: Option<Boolean>, | |
} | |
/// A structure holding an RGBA color. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RGBA { | |
/// The red component, in the [0-255] range. | |
pub r: Integer, | |
/// The green component, in the [0-255] range. | |
pub g: Integer, | |
/// The blue component, in the [0-255] range. | |
pub b: Integer, | |
/// The alpha component, in the [0-1] range (default: 1). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub a: Option<Number>, | |
} | |
/// An array of quad vertices, x immediately followed by y for each point, points clock-wise. | |
pub type Quad = Vec<Number>; | |
/// Box model. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BoxModel { | |
/// Content box | |
pub content: Quad, | |
/// Padding box | |
pub padding: Quad, | |
/// Border box | |
pub border: Quad, | |
/// Margin box | |
pub margin: Quad, | |
/// Node width | |
pub width: Integer, | |
/// Node height | |
pub height: Integer, | |
/// Shape outside coordinates | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shape_outside: Option<ShapeOutsideInfo>, | |
} | |
/// CSS Shape Outside details. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ShapeOutsideInfo { | |
/// Shape bounds | |
pub bounds: Quad, | |
/// Shape coordinate details | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub shape: Vec<Any>, | |
/// Margin shape bounds | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub margin_shape: Vec<Any>, | |
} | |
/// Rectangle. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Rect { | |
/// X coordinate | |
pub x: Number, | |
/// Y coordinate | |
pub y: Number, | |
/// Rectangle width | |
pub width: Number, | |
/// Rectangle height | |
pub height: Number, | |
} | |
/// Method parameters of the `DOM::collectClassNamesFromSubtree` command. | |
#[cfg(feature = "experimental")] | |
pub type CollectClassNamesFromSubtree = CollectClassNamesFromSubtreeRequest; | |
/// Return object of the `DOM::collectClassNamesFromSubtree` command. | |
#[cfg(feature = "experimental")] | |
pub type CollectClassNamesFromSubtreeReturnObject = CollectClassNamesFromSubtreeResponse; | |
/// Request object of the `DOM::collectClassNamesFromSubtree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CollectClassNamesFromSubtreeRequest { | |
/// Id of the node to collect class names. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::collectClassNamesFromSubtree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CollectClassNamesFromSubtreeResponse { | |
/// Class name list. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub class_names: Vec<String>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for CollectClassNamesFromSubtree { | |
const NAME: &'static str = "DOM.collectClassNamesFromSubtree"; | |
type ReturnObject = CollectClassNamesFromSubtreeReturnObject; | |
} | |
/// Method parameters of the `DOM::copyTo` command. | |
#[cfg(feature = "experimental")] | |
pub type CopyTo = CopyToRequest; | |
/// Return object of the `DOM::copyTo` command. | |
#[cfg(feature = "experimental")] | |
pub type CopyToReturnObject = CopyToResponse; | |
/// Request object of the `DOM::copyTo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CopyToRequest { | |
/// Id of the node to copy. | |
pub node_id: NodeId, | |
/// Id of the element to drop the copy into. | |
pub target_node_id: NodeId, | |
/// Drop the copy before this node (if absent, the copy becomes the last child of | |
/// `targetNodeId`). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub insert_before_node_id: Option<NodeId>, | |
} | |
/// Response object of the `DOM::copyTo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CopyToResponse { | |
/// Id of the node clone. | |
pub node_id: NodeId, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for CopyTo { | |
const NAME: &'static str = "DOM.copyTo"; | |
type ReturnObject = CopyToReturnObject; | |
} | |
/// Method parameters of the `DOM::describeNode` command. | |
pub type DescribeNode = DescribeNodeRequest; | |
/// Return object of the `DOM::describeNode` command. | |
pub type DescribeNodeReturnObject = DescribeNodeResponse; | |
/// Request object of the `DOM::describeNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DescribeNodeRequest { | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
/// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the | |
/// entire subtree or provide an integer larger than 0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub depth: Option<Integer>, | |
/// Whether or not iframes and shadow roots should be traversed when returning the subtree | |
/// (default is false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pierce: Option<Boolean>, | |
} | |
/// Response object of the `DOM::describeNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DescribeNodeResponse { | |
/// Node description. | |
pub node: Node, | |
} | |
impl Method for DescribeNode { | |
const NAME: &'static str = "DOM.describeNode"; | |
type ReturnObject = DescribeNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `DOM::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `DOM::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `DOM::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "DOM.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `DOM::discardSearchResults` command. | |
#[cfg(feature = "experimental")] | |
pub type DiscardSearchResults = DiscardSearchResultsRequest; | |
/// Return object of the `DOM::discardSearchResults` command. | |
#[cfg(feature = "experimental")] | |
pub type DiscardSearchResultsReturnObject = DiscardSearchResultsResponse; | |
/// Request object of the `DOM::discardSearchResults` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DiscardSearchResultsRequest { | |
/// Unique search session identifier. | |
pub search_id: String, | |
} | |
/// Response object of the `DOM::discardSearchResults` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DiscardSearchResultsResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for DiscardSearchResults { | |
const NAME: &'static str = "DOM.discardSearchResults"; | |
type ReturnObject = DiscardSearchResultsReturnObject; | |
} | |
/// Method parameters of the `DOM::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `DOM::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `DOM::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `DOM::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "DOM.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `DOM::focus` command. | |
pub type Focus = FocusRequest; | |
/// Return object of the `DOM::focus` command. | |
pub type FocusReturnObject = FocusResponse; | |
/// Request object of the `DOM::focus` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FocusRequest { | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
} | |
/// Response object of the `DOM::focus` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FocusResponse { | |
} | |
impl Method for Focus { | |
const NAME: &'static str = "DOM.focus"; | |
type ReturnObject = FocusReturnObject; | |
} | |
/// Method parameters of the `DOM::getAttributes` command. | |
pub type GetAttributes = GetAttributesRequest; | |
/// Return object of the `DOM::getAttributes` command. | |
pub type GetAttributesReturnObject = GetAttributesResponse; | |
/// Request object of the `DOM::getAttributes` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAttributesRequest { | |
/// Id of the node to retrieve attibutes for. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::getAttributes` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAttributesResponse { | |
/// An interleaved array of node attribute names and values. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub attributes: Vec<String>, | |
} | |
impl Method for GetAttributes { | |
const NAME: &'static str = "DOM.getAttributes"; | |
type ReturnObject = GetAttributesReturnObject; | |
} | |
/// Method parameters of the `DOM::getBoxModel` command. | |
pub type GetBoxModel = GetBoxModelRequest; | |
/// Return object of the `DOM::getBoxModel` command. | |
pub type GetBoxModelReturnObject = GetBoxModelResponse; | |
/// Request object of the `DOM::getBoxModel` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBoxModelRequest { | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
} | |
/// Response object of the `DOM::getBoxModel` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBoxModelResponse { | |
/// Box model for the node. | |
pub model: BoxModel, | |
} | |
impl Method for GetBoxModel { | |
const NAME: &'static str = "DOM.getBoxModel"; | |
type ReturnObject = GetBoxModelReturnObject; | |
} | |
/// Method parameters of the `DOM::getContentQuads` command. | |
#[cfg(feature = "experimental")] | |
pub type GetContentQuads = GetContentQuadsRequest; | |
/// Return object of the `DOM::getContentQuads` command. | |
#[cfg(feature = "experimental")] | |
pub type GetContentQuadsReturnObject = GetContentQuadsResponse; | |
/// Request object of the `DOM::getContentQuads` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetContentQuadsRequest { | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
} | |
/// Response object of the `DOM::getContentQuads` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetContentQuadsResponse { | |
/// Quads that describe node layout relative to viewport. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub quads: Vec<Quad>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetContentQuads { | |
const NAME: &'static str = "DOM.getContentQuads"; | |
type ReturnObject = GetContentQuadsReturnObject; | |
} | |
/// Method parameters of the `DOM::getDocument` command. | |
pub type GetDocument = GetDocumentRequest; | |
/// Return object of the `DOM::getDocument` command. | |
pub type GetDocumentReturnObject = GetDocumentResponse; | |
/// Request object of the `DOM::getDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDocumentRequest { | |
/// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the | |
/// entire subtree or provide an integer larger than 0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub depth: Option<Integer>, | |
/// Whether or not iframes and shadow roots should be traversed when returning the subtree | |
/// (default is false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pierce: Option<Boolean>, | |
} | |
/// Response object of the `DOM::getDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDocumentResponse { | |
/// Resulting node. | |
pub root: Node, | |
} | |
impl Method for GetDocument { | |
const NAME: &'static str = "DOM.getDocument"; | |
type ReturnObject = GetDocumentReturnObject; | |
} | |
/// Method parameters of the `DOM::getFlattenedDocument` command. | |
pub type GetFlattenedDocument = GetFlattenedDocumentRequest; | |
/// Return object of the `DOM::getFlattenedDocument` command. | |
pub type GetFlattenedDocumentReturnObject = GetFlattenedDocumentResponse; | |
/// Request object of the `DOM::getFlattenedDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFlattenedDocumentRequest { | |
/// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the | |
/// entire subtree or provide an integer larger than 0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub depth: Option<Integer>, | |
/// Whether or not iframes and shadow roots should be traversed when returning the subtree | |
/// (default is false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pierce: Option<Boolean>, | |
} | |
/// Response object of the `DOM::getFlattenedDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFlattenedDocumentResponse { | |
/// Resulting node. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub nodes: Vec<Node>, | |
} | |
impl Method for GetFlattenedDocument { | |
const NAME: &'static str = "DOM.getFlattenedDocument"; | |
type ReturnObject = GetFlattenedDocumentReturnObject; | |
} | |
/// Method parameters of the `DOM::getNodeForLocation` command. | |
#[cfg(feature = "experimental")] | |
pub type GetNodeForLocation = GetNodeForLocationRequest; | |
/// Return object of the `DOM::getNodeForLocation` command. | |
#[cfg(feature = "experimental")] | |
pub type GetNodeForLocationReturnObject = GetNodeForLocationResponse; | |
/// Request object of the `DOM::getNodeForLocation` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNodeForLocationRequest { | |
/// X coordinate. | |
pub x: Integer, | |
/// Y coordinate. | |
pub y: Integer, | |
/// False to skip to the nearest non-UA shadow root ancestor (default: false). | |
#[serde(rename = "includeUserAgentShadowDOM")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_user_agent_shadow_dom: Option<Boolean>, | |
} | |
/// Response object of the `DOM::getNodeForLocation` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNodeForLocationResponse { | |
/// Resulting node. | |
pub backend_node_id: BackendNodeId, | |
/// Id of the node at given coordinates, only when enabled and requested document. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetNodeForLocation { | |
const NAME: &'static str = "DOM.getNodeForLocation"; | |
type ReturnObject = GetNodeForLocationReturnObject; | |
} | |
/// Method parameters of the `DOM::getOuterHTML` command. | |
pub type GetOuterHTML = GetOuterHTMLRequest; | |
/// Return object of the `DOM::getOuterHTML` command. | |
pub type GetOuterHTMLReturnObject = GetOuterHTMLResponse; | |
/// Request object of the `DOM::getOuterHTML` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetOuterHTMLRequest { | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
} | |
/// Response object of the `DOM::getOuterHTML` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetOuterHTMLResponse { | |
/// Outer HTML markup. | |
#[serde(rename = "outerHTML")] | |
pub outer_html: String, | |
} | |
impl Method for GetOuterHTML { | |
const NAME: &'static str = "DOM.getOuterHTML"; | |
type ReturnObject = GetOuterHTMLReturnObject; | |
} | |
/// Method parameters of the `DOM::getRelayoutBoundary` command. | |
#[cfg(feature = "experimental")] | |
pub type GetRelayoutBoundary = GetRelayoutBoundaryRequest; | |
/// Return object of the `DOM::getRelayoutBoundary` command. | |
#[cfg(feature = "experimental")] | |
pub type GetRelayoutBoundaryReturnObject = GetRelayoutBoundaryResponse; | |
/// Request object of the `DOM::getRelayoutBoundary` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetRelayoutBoundaryRequest { | |
/// Id of the node. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::getRelayoutBoundary` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetRelayoutBoundaryResponse { | |
/// Relayout boundary node id for the given node. | |
pub node_id: NodeId, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetRelayoutBoundary { | |
const NAME: &'static str = "DOM.getRelayoutBoundary"; | |
type ReturnObject = GetRelayoutBoundaryReturnObject; | |
} | |
/// Method parameters of the `DOM::getSearchResults` command. | |
#[cfg(feature = "experimental")] | |
pub type GetSearchResults = GetSearchResultsRequest; | |
/// Return object of the `DOM::getSearchResults` command. | |
#[cfg(feature = "experimental")] | |
pub type GetSearchResultsReturnObject = GetSearchResultsResponse; | |
/// Request object of the `DOM::getSearchResults` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSearchResultsRequest { | |
/// Unique search session identifier. | |
pub search_id: String, | |
/// Start index of the search result to be returned. | |
pub from_index: Integer, | |
/// End index of the search result to be returned. | |
pub to_index: Integer, | |
} | |
/// Response object of the `DOM::getSearchResults` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSearchResultsResponse { | |
/// Ids of the search result nodes. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub node_ids: Vec<NodeId>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetSearchResults { | |
const NAME: &'static str = "DOM.getSearchResults"; | |
type ReturnObject = GetSearchResultsReturnObject; | |
} | |
/// Method parameters of the `DOM::hideHighlight` command. | |
pub type HideHighlight = HideHighlightRequest; | |
/// Return object of the `DOM::hideHighlight` command. | |
pub type HideHighlightReturnObject = HideHighlightResponse; | |
/// Request object of the `DOM::hideHighlight` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HideHighlightRequest { | |
} | |
/// Response object of the `DOM::hideHighlight` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HideHighlightResponse { | |
} | |
impl Method for HideHighlight { | |
const NAME: &'static str = "DOM.hideHighlight"; | |
type ReturnObject = HideHighlightReturnObject; | |
} | |
/// Method parameters of the `DOM::highlightNode` command. | |
pub type HighlightNode = HighlightNodeRequest; | |
/// Return object of the `DOM::highlightNode` command. | |
pub type HighlightNodeReturnObject = HighlightNodeResponse; | |
/// Request object of the `DOM::highlightNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightNodeRequest { | |
} | |
/// Response object of the `DOM::highlightNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightNodeResponse { | |
} | |
impl Method for HighlightNode { | |
const NAME: &'static str = "DOM.highlightNode"; | |
type ReturnObject = HighlightNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::highlightRect` command. | |
pub type HighlightRect = HighlightRectRequest; | |
/// Return object of the `DOM::highlightRect` command. | |
pub type HighlightRectReturnObject = HighlightRectResponse; | |
/// Request object of the `DOM::highlightRect` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightRectRequest { | |
} | |
/// Response object of the `DOM::highlightRect` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightRectResponse { | |
} | |
impl Method for HighlightRect { | |
const NAME: &'static str = "DOM.highlightRect"; | |
type ReturnObject = HighlightRectReturnObject; | |
} | |
/// Method parameters of the `DOM::markUndoableState` command. | |
#[cfg(feature = "experimental")] | |
pub type MarkUndoableState = MarkUndoableStateRequest; | |
/// Return object of the `DOM::markUndoableState` command. | |
#[cfg(feature = "experimental")] | |
pub type MarkUndoableStateReturnObject = MarkUndoableStateResponse; | |
/// Request object of the `DOM::markUndoableState` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MarkUndoableStateRequest { | |
} | |
/// Response object of the `DOM::markUndoableState` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MarkUndoableStateResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for MarkUndoableState { | |
const NAME: &'static str = "DOM.markUndoableState"; | |
type ReturnObject = MarkUndoableStateReturnObject; | |
} | |
/// Method parameters of the `DOM::moveTo` command. | |
pub type MoveTo = MoveToRequest; | |
/// Return object of the `DOM::moveTo` command. | |
pub type MoveToReturnObject = MoveToResponse; | |
/// Request object of the `DOM::moveTo` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MoveToRequest { | |
/// Id of the node to move. | |
pub node_id: NodeId, | |
/// Id of the element to drop the moved node into. | |
pub target_node_id: NodeId, | |
/// Drop node before this one (if absent, the moved node becomes the last child of | |
/// `targetNodeId`). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub insert_before_node_id: Option<NodeId>, | |
} | |
/// Response object of the `DOM::moveTo` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MoveToResponse { | |
/// New id of the moved node. | |
pub node_id: NodeId, | |
} | |
impl Method for MoveTo { | |
const NAME: &'static str = "DOM.moveTo"; | |
type ReturnObject = MoveToReturnObject; | |
} | |
/// Method parameters of the `DOM::performSearch` command. | |
#[cfg(feature = "experimental")] | |
pub type PerformSearch = PerformSearchRequest; | |
/// Return object of the `DOM::performSearch` command. | |
#[cfg(feature = "experimental")] | |
pub type PerformSearchReturnObject = PerformSearchResponse; | |
/// Request object of the `DOM::performSearch` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PerformSearchRequest { | |
/// Plain text or query selector or XPath search query. | |
pub query: String, | |
/// True to search in user agent shadow DOM. | |
#[serde(rename = "includeUserAgentShadowDOM")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_user_agent_shadow_dom: Option<Boolean>, | |
} | |
/// Response object of the `DOM::performSearch` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PerformSearchResponse { | |
/// Unique search session identifier. | |
pub search_id: String, | |
/// Number of search results. | |
pub result_count: Integer, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for PerformSearch { | |
const NAME: &'static str = "DOM.performSearch"; | |
type ReturnObject = PerformSearchReturnObject; | |
} | |
/// Method parameters of the `DOM::pushNodeByPathToFrontend` command. | |
#[cfg(feature = "experimental")] | |
pub type PushNodeByPathToFrontend = PushNodeByPathToFrontendRequest; | |
/// Return object of the `DOM::pushNodeByPathToFrontend` command. | |
#[cfg(feature = "experimental")] | |
pub type PushNodeByPathToFrontendReturnObject = PushNodeByPathToFrontendResponse; | |
/// Request object of the `DOM::pushNodeByPathToFrontend` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PushNodeByPathToFrontendRequest { | |
/// Path to node in the proprietary format. | |
pub path: String, | |
} | |
/// Response object of the `DOM::pushNodeByPathToFrontend` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PushNodeByPathToFrontendResponse { | |
/// Id of the node for given path. | |
pub node_id: NodeId, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for PushNodeByPathToFrontend { | |
const NAME: &'static str = "DOM.pushNodeByPathToFrontend"; | |
type ReturnObject = PushNodeByPathToFrontendReturnObject; | |
} | |
/// Method parameters of the `DOM::pushNodesByBackendIdsToFrontend` command. | |
#[cfg(feature = "experimental")] | |
pub type PushNodesByBackendIdsToFrontend = PushNodesByBackendIdsToFrontendRequest; | |
/// Return object of the `DOM::pushNodesByBackendIdsToFrontend` command. | |
#[cfg(feature = "experimental")] | |
pub type PushNodesByBackendIdsToFrontendReturnObject = PushNodesByBackendIdsToFrontendResponse; | |
/// Request object of the `DOM::pushNodesByBackendIdsToFrontend` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PushNodesByBackendIdsToFrontendRequest { | |
/// The array of backend node ids. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub backend_node_ids: Vec<BackendNodeId>, | |
} | |
/// Response object of the `DOM::pushNodesByBackendIdsToFrontend` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PushNodesByBackendIdsToFrontendResponse { | |
/// The array of ids of pushed nodes that correspond to the backend ids specified in | |
/// backendNodeIds. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub node_ids: Vec<NodeId>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for PushNodesByBackendIdsToFrontend { | |
const NAME: &'static str = "DOM.pushNodesByBackendIdsToFrontend"; | |
type ReturnObject = PushNodesByBackendIdsToFrontendReturnObject; | |
} | |
/// Method parameters of the `DOM::querySelector` command. | |
pub type QuerySelector = QuerySelectorRequest; | |
/// Return object of the `DOM::querySelector` command. | |
pub type QuerySelectorReturnObject = QuerySelectorResponse; | |
/// Request object of the `DOM::querySelector` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct QuerySelectorRequest { | |
/// Id of the node to query upon. | |
pub node_id: NodeId, | |
/// Selector string. | |
pub selector: String, | |
} | |
/// Response object of the `DOM::querySelector` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct QuerySelectorResponse { | |
/// Query selector result. | |
pub node_id: NodeId, | |
} | |
impl Method for QuerySelector { | |
const NAME: &'static str = "DOM.querySelector"; | |
type ReturnObject = QuerySelectorReturnObject; | |
} | |
/// Method parameters of the `DOM::querySelectorAll` command. | |
pub type QuerySelectorAll = QuerySelectorAllRequest; | |
/// Return object of the `DOM::querySelectorAll` command. | |
pub type QuerySelectorAllReturnObject = QuerySelectorAllResponse; | |
/// Request object of the `DOM::querySelectorAll` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct QuerySelectorAllRequest { | |
/// Id of the node to query upon. | |
pub node_id: NodeId, | |
/// Selector string. | |
pub selector: String, | |
} | |
/// Response object of the `DOM::querySelectorAll` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct QuerySelectorAllResponse { | |
/// Query selector result. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub node_ids: Vec<NodeId>, | |
} | |
impl Method for QuerySelectorAll { | |
const NAME: &'static str = "DOM.querySelectorAll"; | |
type ReturnObject = QuerySelectorAllReturnObject; | |
} | |
/// Method parameters of the `DOM::redo` command. | |
#[cfg(feature = "experimental")] | |
pub type Redo = RedoRequest; | |
/// Return object of the `DOM::redo` command. | |
#[cfg(feature = "experimental")] | |
pub type RedoReturnObject = RedoResponse; | |
/// Request object of the `DOM::redo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RedoRequest { | |
} | |
/// Response object of the `DOM::redo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RedoResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for Redo { | |
const NAME: &'static str = "DOM.redo"; | |
type ReturnObject = RedoReturnObject; | |
} | |
/// Method parameters of the `DOM::removeAttribute` command. | |
pub type RemoveAttribute = RemoveAttributeRequest; | |
/// Return object of the `DOM::removeAttribute` command. | |
pub type RemoveAttributeReturnObject = RemoveAttributeResponse; | |
/// Request object of the `DOM::removeAttribute` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveAttributeRequest { | |
/// Id of the element to remove attribute from. | |
pub node_id: NodeId, | |
/// Name of the attribute to remove. | |
pub name: String, | |
} | |
/// Response object of the `DOM::removeAttribute` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveAttributeResponse { | |
} | |
impl Method for RemoveAttribute { | |
const NAME: &'static str = "DOM.removeAttribute"; | |
type ReturnObject = RemoveAttributeReturnObject; | |
} | |
/// Method parameters of the `DOM::removeNode` command. | |
pub type RemoveNode = RemoveNodeRequest; | |
/// Return object of the `DOM::removeNode` command. | |
pub type RemoveNodeReturnObject = RemoveNodeResponse; | |
/// Request object of the `DOM::removeNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveNodeRequest { | |
/// Id of the node to remove. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::removeNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveNodeResponse { | |
} | |
impl Method for RemoveNode { | |
const NAME: &'static str = "DOM.removeNode"; | |
type ReturnObject = RemoveNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::requestChildNodes` command. | |
pub type RequestChildNodes = RequestChildNodesRequest; | |
/// Return object of the `DOM::requestChildNodes` command. | |
pub type RequestChildNodesReturnObject = RequestChildNodesResponse; | |
/// Request object of the `DOM::requestChildNodes` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestChildNodesRequest { | |
/// Id of the node to get children for. | |
pub node_id: NodeId, | |
/// The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the | |
/// entire subtree or provide an integer larger than 0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub depth: Option<Integer>, | |
/// Whether or not iframes and shadow roots should be traversed when returning the sub-tree | |
/// (default is false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pierce: Option<Boolean>, | |
} | |
/// Response object of the `DOM::requestChildNodes` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestChildNodesResponse { | |
} | |
impl Method for RequestChildNodes { | |
const NAME: &'static str = "DOM.requestChildNodes"; | |
type ReturnObject = RequestChildNodesReturnObject; | |
} | |
/// Method parameters of the `DOM::requestNode` command. | |
pub type RequestNode = RequestNodeRequest; | |
/// Return object of the `DOM::requestNode` command. | |
pub type RequestNodeReturnObject = RequestNodeResponse; | |
/// Request object of the `DOM::requestNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestNodeRequest { | |
/// JavaScript object id to convert into node. | |
pub object_id: runtime::RemoteObjectId, | |
} | |
/// Response object of the `DOM::requestNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestNodeResponse { | |
/// Node id for given object. | |
pub node_id: NodeId, | |
} | |
impl Method for RequestNode { | |
const NAME: &'static str = "DOM.requestNode"; | |
type ReturnObject = RequestNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::resolveNode` command. | |
pub type ResolveNode = ResolveNodeRequest; | |
/// Return object of the `DOM::resolveNode` command. | |
pub type ResolveNodeReturnObject = ResolveNodeResponse; | |
/// Request object of the `DOM::resolveNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveNodeRequest { | |
/// Id of the node to resolve. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Backend identifier of the node to resolve. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
/// Symbolic group name that can be used to release multiple objects. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_group: Option<String>, | |
/// Execution context in which to resolve the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub execution_context_id: Option<runtime::ExecutionContextId>, | |
} | |
/// Response object of the `DOM::resolveNode` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveNodeResponse { | |
/// JavaScript object wrapper for given node. | |
pub object: runtime::RemoteObject, | |
} | |
impl Method for ResolveNode { | |
const NAME: &'static str = "DOM.resolveNode"; | |
type ReturnObject = ResolveNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::setAttributeValue` command. | |
pub type SetAttributeValue = SetAttributeValueRequest; | |
/// Return object of the `DOM::setAttributeValue` command. | |
pub type SetAttributeValueReturnObject = SetAttributeValueResponse; | |
/// Request object of the `DOM::setAttributeValue` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetAttributeValueRequest { | |
/// Id of the element to set attribute for. | |
pub node_id: NodeId, | |
/// Attribute name. | |
pub name: String, | |
/// Attribute value. | |
pub value: String, | |
} | |
/// Response object of the `DOM::setAttributeValue` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetAttributeValueResponse { | |
} | |
impl Method for SetAttributeValue { | |
const NAME: &'static str = "DOM.setAttributeValue"; | |
type ReturnObject = SetAttributeValueReturnObject; | |
} | |
/// Method parameters of the `DOM::setAttributesAsText` command. | |
pub type SetAttributesAsText = SetAttributesAsTextRequest; | |
/// Return object of the `DOM::setAttributesAsText` command. | |
pub type SetAttributesAsTextReturnObject = SetAttributesAsTextResponse; | |
/// Request object of the `DOM::setAttributesAsText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetAttributesAsTextRequest { | |
/// Id of the element to set attributes for. | |
pub node_id: NodeId, | |
/// Text with a number of attributes. Will parse this text using HTML parser. | |
pub text: String, | |
/// Attribute name to replace with new attributes derived from text in case text parsed | |
/// successfully. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub name: Option<String>, | |
} | |
/// Response object of the `DOM::setAttributesAsText` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetAttributesAsTextResponse { | |
} | |
impl Method for SetAttributesAsText { | |
const NAME: &'static str = "DOM.setAttributesAsText"; | |
type ReturnObject = SetAttributesAsTextReturnObject; | |
} | |
/// Method parameters of the `DOM::setFileInputFiles` command. | |
pub type SetFileInputFiles = SetFileInputFilesRequest; | |
/// Return object of the `DOM::setFileInputFiles` command. | |
pub type SetFileInputFilesReturnObject = SetFileInputFilesResponse; | |
/// Request object of the `DOM::setFileInputFiles` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetFileInputFilesRequest { | |
/// Array of file paths to set. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub files: Vec<String>, | |
/// Identifier of the node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
/// Identifier of the backend node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<BackendNodeId>, | |
/// JavaScript object id of the node wrapper. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
} | |
/// Response object of the `DOM::setFileInputFiles` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetFileInputFilesResponse { | |
} | |
impl Method for SetFileInputFiles { | |
const NAME: &'static str = "DOM.setFileInputFiles"; | |
type ReturnObject = SetFileInputFilesReturnObject; | |
} | |
/// Method parameters of the `DOM::setNodeStackTracesEnabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetNodeStackTracesEnabled = SetNodeStackTracesEnabledRequest; | |
/// Return object of the `DOM::setNodeStackTracesEnabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetNodeStackTracesEnabledReturnObject = SetNodeStackTracesEnabledResponse; | |
/// Request object of the `DOM::setNodeStackTracesEnabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeStackTracesEnabledRequest { | |
/// Enable or disable. | |
pub enable: Boolean, | |
} | |
/// Response object of the `DOM::setNodeStackTracesEnabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeStackTracesEnabledResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetNodeStackTracesEnabled { | |
const NAME: &'static str = "DOM.setNodeStackTracesEnabled"; | |
type ReturnObject = SetNodeStackTracesEnabledReturnObject; | |
} | |
/// Method parameters of the `DOM::getNodeStackTraces` command. | |
#[cfg(feature = "experimental")] | |
pub type GetNodeStackTraces = GetNodeStackTracesRequest; | |
/// Return object of the `DOM::getNodeStackTraces` command. | |
#[cfg(feature = "experimental")] | |
pub type GetNodeStackTracesReturnObject = GetNodeStackTracesResponse; | |
/// Request object of the `DOM::getNodeStackTraces` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNodeStackTracesRequest { | |
/// Id of the node to get stack traces for. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::getNodeStackTraces` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNodeStackTracesResponse { | |
/// Creation stack trace, if available. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub creation: Option<runtime::StackTrace>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetNodeStackTraces { | |
const NAME: &'static str = "DOM.getNodeStackTraces"; | |
type ReturnObject = GetNodeStackTracesReturnObject; | |
} | |
/// Method parameters of the `DOM::getFileInfo` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFileInfo = GetFileInfoRequest; | |
/// Return object of the `DOM::getFileInfo` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFileInfoReturnObject = GetFileInfoResponse; | |
/// Request object of the `DOM::getFileInfo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFileInfoRequest { | |
/// JavaScript object id of the node wrapper. | |
pub object_id: runtime::RemoteObjectId, | |
} | |
/// Response object of the `DOM::getFileInfo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFileInfoResponse { | |
pub path: String, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetFileInfo { | |
const NAME: &'static str = "DOM.getFileInfo"; | |
type ReturnObject = GetFileInfoReturnObject; | |
} | |
/// Method parameters of the `DOM::setInspectedNode` command. | |
#[cfg(feature = "experimental")] | |
pub type SetInspectedNode = SetInspectedNodeRequest; | |
/// Return object of the `DOM::setInspectedNode` command. | |
#[cfg(feature = "experimental")] | |
pub type SetInspectedNodeReturnObject = SetInspectedNodeResponse; | |
/// Request object of the `DOM::setInspectedNode` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInspectedNodeRequest { | |
/// DOM node id to be accessible by means of $x command line API. | |
pub node_id: NodeId, | |
} | |
/// Response object of the `DOM::setInspectedNode` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInspectedNodeResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetInspectedNode { | |
const NAME: &'static str = "DOM.setInspectedNode"; | |
type ReturnObject = SetInspectedNodeReturnObject; | |
} | |
/// Method parameters of the `DOM::setNodeName` command. | |
pub type SetNodeName = SetNodeNameRequest; | |
/// Return object of the `DOM::setNodeName` command. | |
pub type SetNodeNameReturnObject = SetNodeNameResponse; | |
/// Request object of the `DOM::setNodeName` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeNameRequest { | |
/// Id of the node to set name for. | |
pub node_id: NodeId, | |
/// New node's name. | |
pub name: String, | |
} | |
/// Response object of the `DOM::setNodeName` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeNameResponse { | |
/// New node's id. | |
pub node_id: NodeId, | |
} | |
impl Method for SetNodeName { | |
const NAME: &'static str = "DOM.setNodeName"; | |
type ReturnObject = SetNodeNameReturnObject; | |
} | |
/// Method parameters of the `DOM::setNodeValue` command. | |
pub type SetNodeValue = SetNodeValueRequest; | |
/// Return object of the `DOM::setNodeValue` command. | |
pub type SetNodeValueReturnObject = SetNodeValueResponse; | |
/// Request object of the `DOM::setNodeValue` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeValueRequest { | |
/// Id of the node to set value for. | |
pub node_id: NodeId, | |
/// New node's value. | |
pub value: String, | |
} | |
/// Response object of the `DOM::setNodeValue` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNodeValueResponse { | |
} | |
impl Method for SetNodeValue { | |
const NAME: &'static str = "DOM.setNodeValue"; | |
type ReturnObject = SetNodeValueReturnObject; | |
} | |
/// Method parameters of the `DOM::setOuterHTML` command. | |
pub type SetOuterHTML = SetOuterHTMLRequest; | |
/// Return object of the `DOM::setOuterHTML` command. | |
pub type SetOuterHTMLReturnObject = SetOuterHTMLResponse; | |
/// Request object of the `DOM::setOuterHTML` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetOuterHTMLRequest { | |
/// Id of the node to set markup for. | |
pub node_id: NodeId, | |
/// Outer HTML markup to set. | |
#[serde(rename = "outerHTML")] | |
pub outer_html: String, | |
} | |
/// Response object of the `DOM::setOuterHTML` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetOuterHTMLResponse { | |
} | |
impl Method for SetOuterHTML { | |
const NAME: &'static str = "DOM.setOuterHTML"; | |
type ReturnObject = SetOuterHTMLReturnObject; | |
} | |
/// Method parameters of the `DOM::undo` command. | |
#[cfg(feature = "experimental")] | |
pub type Undo = UndoRequest; | |
/// Return object of the `DOM::undo` command. | |
#[cfg(feature = "experimental")] | |
pub type UndoReturnObject = UndoResponse; | |
/// Request object of the `DOM::undo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct UndoRequest { | |
} | |
/// Response object of the `DOM::undo` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct UndoResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for Undo { | |
const NAME: &'static str = "DOM.undo"; | |
type ReturnObject = UndoReturnObject; | |
} | |
/// Method parameters of the `DOM::getFrameOwner` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFrameOwner = GetFrameOwnerRequest; | |
/// Return object of the `DOM::getFrameOwner` command. | |
#[cfg(feature = "experimental")] | |
pub type GetFrameOwnerReturnObject = GetFrameOwnerResponse; | |
/// Request object of the `DOM::getFrameOwner` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFrameOwnerRequest { | |
pub frame_id: page::FrameId, | |
} | |
/// Response object of the `DOM::getFrameOwner` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFrameOwnerResponse { | |
/// Resulting node. | |
pub backend_node_id: BackendNodeId, | |
/// Id of the node at given coordinates, only when enabled and requested document. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<NodeId>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetFrameOwner { | |
const NAME: &'static str = "DOM.getFrameOwner"; | |
type ReturnObject = GetFrameOwnerReturnObject; | |
} | |
/// Fired when `Element`'s attribute is modified. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AttributeModifiedEvent { | |
/// Id of the node that has changed. | |
pub node_id: NodeId, | |
/// Attribute name. | |
pub name: String, | |
/// Attribute value. | |
pub value: String, | |
} | |
/// Fired when `Element`'s attribute is removed. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AttributeRemovedEvent { | |
/// Id of the node that has changed. | |
pub node_id: NodeId, | |
/// A ttribute name. | |
pub name: String, | |
} | |
/// Mirrors `DOMCharacterDataModified` event. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CharacterDataModifiedEvent { | |
/// Id of the node that has changed. | |
pub node_id: NodeId, | |
/// New text value. | |
pub character_data: String, | |
} | |
/// Fired when `Container`'s child node count has changed. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ChildNodeCountUpdatedEvent { | |
/// Id of the node that has changed. | |
pub node_id: NodeId, | |
/// New node count. | |
pub child_node_count: Integer, | |
} | |
/// Mirrors `DOMNodeInserted` event. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ChildNodeInsertedEvent { | |
/// Id of the node that has changed. | |
pub parent_node_id: NodeId, | |
/// If of the previous siblint. | |
pub previous_node_id: NodeId, | |
/// Inserted node data. | |
pub node: Node, | |
} | |
/// Mirrors `DOMNodeRemoved` event. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ChildNodeRemovedEvent { | |
/// Parent id. | |
pub parent_node_id: NodeId, | |
/// Id of the node that has been removed. | |
pub node_id: NodeId, | |
} | |
/// Called when distrubution is changed. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DistributedNodesUpdatedEvent { | |
/// Insertion point where distrubuted nodes were updated. | |
pub insertion_point_id: NodeId, | |
/// Distributed nodes for given insertion point. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub distributed_nodes: Vec<BackendNode>, | |
} | |
/// Fired when `Document` has been totally updated. Node ids are no longer valid. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DocumentUpdatedEvent { | |
} | |
/// Fired when `Element`'s inline style is modified via a CSS property modification. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InlineStyleInvalidatedEvent { | |
/// Ids of the nodes for which the inline styles have been invalidated. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub node_ids: Vec<NodeId>, | |
} | |
/// Called when a pseudo element is added to an element. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PseudoElementAddedEvent { | |
/// Pseudo element's parent element id. | |
pub parent_id: NodeId, | |
/// The added pseudo element. | |
pub pseudo_element: Node, | |
} | |
/// Called when a pseudo element is removed from an element. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PseudoElementRemovedEvent { | |
/// Pseudo element's parent element id. | |
pub parent_id: NodeId, | |
/// The removed pseudo element id. | |
pub pseudo_element_id: NodeId, | |
} | |
/// Fired when backend wants to provide client with the missing DOM structure. This happens upon | |
/// most of the calls requesting node ids. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetChildNodesEvent { | |
/// Parent node id to populate with children. | |
pub parent_id: NodeId, | |
/// Child nodes array. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub nodes: Vec<Node>, | |
} | |
/// Called when shadow root is popped from the element. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ShadowRootPoppedEvent { | |
/// Host element id. | |
pub host_id: NodeId, | |
/// Shadow root id. | |
pub root_id: NodeId, | |
} | |
/// Called when shadow root is pushed into the element. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ShadowRootPushedEvent { | |
/// Host element id. | |
pub host_id: NodeId, | |
/// Shadow root. | |
pub root: Node, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Fired when `Element`'s attribute is modified. | |
#[serde(rename = "DOM.attributeModified")] | |
AttributeModified(AttributeModifiedEvent), | |
/// Fired when `Element`'s attribute is removed. | |
#[serde(rename = "DOM.attributeRemoved")] | |
AttributeRemoved(AttributeRemovedEvent), | |
/// Mirrors `DOMCharacterDataModified` event. | |
#[serde(rename = "DOM.characterDataModified")] | |
CharacterDataModified(CharacterDataModifiedEvent), | |
/// Fired when `Container`'s child node count has changed. | |
#[serde(rename = "DOM.childNodeCountUpdated")] | |
ChildNodeCountUpdated(ChildNodeCountUpdatedEvent), | |
/// Mirrors `DOMNodeInserted` event. | |
#[serde(rename = "DOM.childNodeInserted")] | |
ChildNodeInserted(ChildNodeInsertedEvent), | |
/// Mirrors `DOMNodeRemoved` event. | |
#[serde(rename = "DOM.childNodeRemoved")] | |
ChildNodeRemoved(ChildNodeRemovedEvent), | |
/// Called when distrubution is changed. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.distributedNodesUpdated")] | |
DistributedNodesUpdated(DistributedNodesUpdatedEvent), | |
/// Fired when `Document` has been totally updated. Node ids are no longer valid. | |
#[serde(rename = "DOM.documentUpdated")] | |
DocumentUpdated(DocumentUpdatedEvent), | |
/// Fired when `Element`'s inline style is modified via a CSS property modification. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.inlineStyleInvalidated")] | |
InlineStyleInvalidated(InlineStyleInvalidatedEvent), | |
/// Called when a pseudo element is added to an element. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.pseudoElementAdded")] | |
PseudoElementAdded(PseudoElementAddedEvent), | |
/// Called when a pseudo element is removed from an element. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.pseudoElementRemoved")] | |
PseudoElementRemoved(PseudoElementRemovedEvent), | |
/// Fired when backend wants to provide client with the missing DOM structure. This happens upon | |
/// most of the calls requesting node ids. | |
#[serde(rename = "DOM.setChildNodes")] | |
SetChildNodes(SetChildNodesEvent), | |
/// Called when shadow root is popped from the element. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.shadowRootPopped")] | |
ShadowRootPopped(ShadowRootPoppedEvent), | |
/// Called when shadow root is pushed into the element. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "DOM.shadowRootPushed")] | |
ShadowRootPushed(ShadowRootPushedEvent), | |
} | |
} | |
/// DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript | |
/// execution will stop on these operations as if there was a regular breakpoint set. | |
#[cfg(any(feature = "all", feature = "dom_debugger"))] | |
pub trait DOMDebugger: DOM + Debugger + Runtime { | |
type Error; | |
/// Returns event listeners of the given object. | |
fn get_event_listeners(&mut self, object_id: runtime::RemoteObjectId, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(Vec<dom_debugger::EventListener>), <Self as DOMDebugger>::Error>; | |
/// Removes DOM breakpoint that was set using `setDOMBreakpoint`. | |
fn remove_dom_breakpoint(&mut self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Removes breakpoint on particular DOM event. | |
fn remove_event_listener_breakpoint(&mut self, event_name: String, target_name: Option<String>) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Removes breakpoint on particular native event. | |
#[cfg(feature = "experimental")] | |
fn remove_instrumentation_breakpoint(&mut self, event_name: String) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Removes breakpoint from XMLHttpRequest. | |
fn remove_xhr_breakpoint(&mut self, url: String) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Sets breakpoint on particular operation with DOM. | |
fn set_dom_breakpoint(&mut self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Sets breakpoint on particular DOM event. | |
fn set_event_listener_breakpoint(&mut self, event_name: String, target_name: Option<String>) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Sets breakpoint on particular native event. | |
#[cfg(feature = "experimental")] | |
fn set_instrumentation_breakpoint(&mut self, event_name: String) -> Result<(), <Self as DOMDebugger>::Error>; | |
/// Sets breakpoint on XMLHttpRequest. | |
fn set_xhr_breakpoint(&mut self, url: String) -> Result<(), <Self as DOMDebugger>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "dom_debugger"))] | |
impl<T> DOMDebugger for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn get_event_listeners(&mut self, object_id: runtime::RemoteObjectId, depth: Option<Integer>, pierce: Option<Boolean>) -> Result<(Vec<dom_debugger::EventListener>), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::GetEventListenersRequest { object_id, depth, pierce }).map(|res| (res.listeners)) | |
} | |
fn remove_dom_breakpoint(&mut self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::RemoveDOMBreakpointRequest { node_id, r#type }).map(|_| ()) | |
} | |
fn remove_event_listener_breakpoint(&mut self, event_name: String, target_name: Option<String>) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::RemoveEventListenerBreakpointRequest { event_name, target_name }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn remove_instrumentation_breakpoint(&mut self, event_name: String) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::RemoveInstrumentationBreakpointRequest { event_name }).map(|_| ()) | |
} | |
fn remove_xhr_breakpoint(&mut self, url: String) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::RemoveXHRBreakpointRequest { url }).map(|_| ()) | |
} | |
fn set_dom_breakpoint(&mut self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::SetDOMBreakpointRequest { node_id, r#type }).map(|_| ()) | |
} | |
fn set_event_listener_breakpoint(&mut self, event_name: String, target_name: Option<String>) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::SetEventListenerBreakpointRequest { event_name, target_name }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_instrumentation_breakpoint(&mut self, event_name: String) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::SetInstrumentationBreakpointRequest { event_name }).map(|_| ()) | |
} | |
fn set_xhr_breakpoint(&mut self, url: String) -> Result<(), <Self as DOMDebugger>::Error> { | |
CallSite::call(self, dom_debugger::SetXHRBreakpointRequest { url }).map(|_| ()) | |
} | |
} | |
/// DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript | |
/// execution will stop on these operations as if there was a regular breakpoint set. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_debugger")))] | |
pub trait AsyncDOMDebugger: AsyncDOM + AsyncDebugger + AsyncRuntime where Self: Sized { | |
type Error; | |
type GetEventListeners: futures::Future<Item = ((Vec<dom_debugger::EventListener>), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type RemoveDOMBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type RemoveEventListenerBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
#[cfg(feature = "experimental")] | |
type RemoveInstrumentationBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type RemoveXHRBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type SetDOMBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type SetEventListenerBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetInstrumentationBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
type SetXHRBreakpoint: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMDebugger>::Error>; | |
/// Returns event listeners of the given object. | |
fn get_event_listeners(self, object_id: runtime::RemoteObjectId, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOMDebugger>::GetEventListeners; | |
/// Removes DOM breakpoint that was set using `setDOMBreakpoint`. | |
fn remove_dom_breakpoint(self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> <Self as AsyncDOMDebugger>::RemoveDOMBreakpoint; | |
/// Removes breakpoint on particular DOM event. | |
fn remove_event_listener_breakpoint(self, event_name: String, target_name: Option<String>) -> <Self as AsyncDOMDebugger>::RemoveEventListenerBreakpoint; | |
/// Removes breakpoint on particular native event. | |
#[cfg(feature = "experimental")] | |
fn remove_instrumentation_breakpoint(self, event_name: String) -> <Self as AsyncDOMDebugger>::RemoveInstrumentationBreakpoint; | |
/// Removes breakpoint from XMLHttpRequest. | |
fn remove_xhr_breakpoint(self, url: String) -> <Self as AsyncDOMDebugger>::RemoveXHRBreakpoint; | |
/// Sets breakpoint on particular operation with DOM. | |
fn set_dom_breakpoint(self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> <Self as AsyncDOMDebugger>::SetDOMBreakpoint; | |
/// Sets breakpoint on particular DOM event. | |
fn set_event_listener_breakpoint(self, event_name: String, target_name: Option<String>) -> <Self as AsyncDOMDebugger>::SetEventListenerBreakpoint; | |
/// Sets breakpoint on particular native event. | |
#[cfg(feature = "experimental")] | |
fn set_instrumentation_breakpoint(self, event_name: String) -> <Self as AsyncDOMDebugger>::SetInstrumentationBreakpoint; | |
/// Sets breakpoint on XMLHttpRequest. | |
fn set_xhr_breakpoint(self, url: String) -> <Self as AsyncDOMDebugger>::SetXHRBreakpoint; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_debugger")))] | |
impl<T> AsyncDOMDebugger for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type GetEventListeners = Box<dyn futures::Future<Item = ((Vec<dom_debugger::EventListener>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveDOMBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveEventListenerBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type RemoveInstrumentationBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveXHRBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDOMBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetEventListenerBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetInstrumentationBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetXHRBreakpoint = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn get_event_listeners(self, object_id: runtime::RemoteObjectId, depth: Option<Integer>, pierce: Option<Boolean>) -> <Self as AsyncDOMDebugger>::GetEventListeners { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::GetEventListenersRequest { object_id, depth, pierce }).map(|(res, self_)| ((res.listeners), self_))) | |
} | |
fn remove_dom_breakpoint(self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> <Self as AsyncDOMDebugger>::RemoveDOMBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::RemoveDOMBreakpointRequest { node_id, r#type }).map(|(_, self_)| ((), self_))) | |
} | |
fn remove_event_listener_breakpoint(self, event_name: String, target_name: Option<String>) -> <Self as AsyncDOMDebugger>::RemoveEventListenerBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::RemoveEventListenerBreakpointRequest { event_name, target_name }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn remove_instrumentation_breakpoint(self, event_name: String) -> <Self as AsyncDOMDebugger>::RemoveInstrumentationBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::RemoveInstrumentationBreakpointRequest { event_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn remove_xhr_breakpoint(self, url: String) -> <Self as AsyncDOMDebugger>::RemoveXHRBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::RemoveXHRBreakpointRequest { url }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_dom_breakpoint(self, node_id: dom::NodeId, r#type: dom_debugger::DOMBreakpointType) -> <Self as AsyncDOMDebugger>::SetDOMBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::SetDOMBreakpointRequest { node_id, r#type }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_event_listener_breakpoint(self, event_name: String, target_name: Option<String>) -> <Self as AsyncDOMDebugger>::SetEventListenerBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::SetEventListenerBreakpointRequest { event_name, target_name }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_instrumentation_breakpoint(self, event_name: String) -> <Self as AsyncDOMDebugger>::SetInstrumentationBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::SetInstrumentationBreakpointRequest { event_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_xhr_breakpoint(self, url: String) -> <Self as AsyncDOMDebugger>::SetXHRBreakpoint { | |
Box::new(AsyncCallSite::async_call(self, dom_debugger::SetXHRBreakpointRequest { url }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// DOM debugging allows setting breakpoints on particular DOM operations and events. JavaScript | |
/// execution will stop on these operations as if there was a regular breakpoint set. | |
#[cfg(any(feature = "all", feature = "dom_debugger"))] | |
#[allow(deprecated)] | |
pub mod dom_debugger { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// DOM breakpoint type. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DOMBreakpointType { | |
SubtreeModified, | |
AttributeModified, | |
NodeRemoved, | |
} | |
/// Object event listener. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EventListener { | |
/// `EventListener`'s type. | |
#[serde(rename = "type")] | |
pub r#type: String, | |
/// `EventListener`'s useCapture. | |
pub use_capture: Boolean, | |
/// `EventListener`'s passive flag. | |
pub passive: Boolean, | |
/// `EventListener`'s once flag. | |
pub once: Boolean, | |
/// Script id of the handler code. | |
pub script_id: runtime::ScriptId, | |
/// Line number in the script (0-based). | |
pub line_number: Integer, | |
/// Column number in the script (0-based). | |
pub column_number: Integer, | |
/// Event handler function value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub handler: Option<runtime::RemoteObject>, | |
/// Event original handler function value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub original_handler: Option<runtime::RemoteObject>, | |
/// Node the listener is added to (if any). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
} | |
/// Method parameters of the `DOMDebugger::getEventListeners` command. | |
pub type GetEventListeners = GetEventListenersRequest; | |
/// Return object of the `DOMDebugger::getEventListeners` command. | |
pub type GetEventListenersReturnObject = GetEventListenersResponse; | |
/// Request object of the `DOMDebugger::getEventListeners` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetEventListenersRequest { | |
/// Identifier of the object to return listeners for. | |
pub object_id: runtime::RemoteObjectId, | |
/// The maximum depth at which Node children should be retrieved, defaults to 1. Use -1 for the | |
/// entire subtree or provide an integer larger than 0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub depth: Option<Integer>, | |
/// Whether or not iframes and shadow roots should be traversed when returning the subtree | |
/// (default is false). Reports listeners for all contexts if pierce is enabled. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pierce: Option<Boolean>, | |
} | |
/// Response object of the `DOMDebugger::getEventListeners` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetEventListenersResponse { | |
/// Array of relevant listeners. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub listeners: Vec<EventListener>, | |
} | |
impl Method for GetEventListeners { | |
const NAME: &'static str = "DOMDebugger.getEventListeners"; | |
type ReturnObject = GetEventListenersReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::removeDOMBreakpoint` command. | |
pub type RemoveDOMBreakpoint = RemoveDOMBreakpointRequest; | |
/// Return object of the `DOMDebugger::removeDOMBreakpoint` command. | |
pub type RemoveDOMBreakpointReturnObject = RemoveDOMBreakpointResponse; | |
/// Request object of the `DOMDebugger::removeDOMBreakpoint` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveDOMBreakpointRequest { | |
/// Identifier of the node to remove breakpoint from. | |
pub node_id: dom::NodeId, | |
/// Type of the breakpoint to remove. | |
#[serde(rename = "type")] | |
pub r#type: DOMBreakpointType, | |
} | |
/// Response object of the `DOMDebugger::removeDOMBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveDOMBreakpointResponse { | |
} | |
impl Method for RemoveDOMBreakpoint { | |
const NAME: &'static str = "DOMDebugger.removeDOMBreakpoint"; | |
type ReturnObject = RemoveDOMBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::removeEventListenerBreakpoint` command. | |
pub type RemoveEventListenerBreakpoint = RemoveEventListenerBreakpointRequest; | |
/// Return object of the `DOMDebugger::removeEventListenerBreakpoint` command. | |
pub type RemoveEventListenerBreakpointReturnObject = RemoveEventListenerBreakpointResponse; | |
/// Request object of the `DOMDebugger::removeEventListenerBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveEventListenerBreakpointRequest { | |
/// Event name. | |
pub event_name: String, | |
/// EventTarget interface name. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub target_name: Option<String>, | |
} | |
/// Response object of the `DOMDebugger::removeEventListenerBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveEventListenerBreakpointResponse { | |
} | |
impl Method for RemoveEventListenerBreakpoint { | |
const NAME: &'static str = "DOMDebugger.removeEventListenerBreakpoint"; | |
type ReturnObject = RemoveEventListenerBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::removeInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
pub type RemoveInstrumentationBreakpoint = RemoveInstrumentationBreakpointRequest; | |
/// Return object of the `DOMDebugger::removeInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
pub type RemoveInstrumentationBreakpointReturnObject = RemoveInstrumentationBreakpointResponse; | |
/// Request object of the `DOMDebugger::removeInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveInstrumentationBreakpointRequest { | |
/// Instrumentation name to stop on. | |
pub event_name: String, | |
} | |
/// Response object of the `DOMDebugger::removeInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveInstrumentationBreakpointResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for RemoveInstrumentationBreakpoint { | |
const NAME: &'static str = "DOMDebugger.removeInstrumentationBreakpoint"; | |
type ReturnObject = RemoveInstrumentationBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::removeXHRBreakpoint` command. | |
pub type RemoveXHRBreakpoint = RemoveXHRBreakpointRequest; | |
/// Return object of the `DOMDebugger::removeXHRBreakpoint` command. | |
pub type RemoveXHRBreakpointReturnObject = RemoveXHRBreakpointResponse; | |
/// Request object of the `DOMDebugger::removeXHRBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveXHRBreakpointRequest { | |
/// Resource URL substring. | |
pub url: String, | |
} | |
/// Response object of the `DOMDebugger::removeXHRBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveXHRBreakpointResponse { | |
} | |
impl Method for RemoveXHRBreakpoint { | |
const NAME: &'static str = "DOMDebugger.removeXHRBreakpoint"; | |
type ReturnObject = RemoveXHRBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::setDOMBreakpoint` command. | |
pub type SetDOMBreakpoint = SetDOMBreakpointRequest; | |
/// Return object of the `DOMDebugger::setDOMBreakpoint` command. | |
pub type SetDOMBreakpointReturnObject = SetDOMBreakpointResponse; | |
/// Request object of the `DOMDebugger::setDOMBreakpoint` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDOMBreakpointRequest { | |
/// Identifier of the node to set breakpoint on. | |
pub node_id: dom::NodeId, | |
/// Type of the operation to stop upon. | |
#[serde(rename = "type")] | |
pub r#type: DOMBreakpointType, | |
} | |
/// Response object of the `DOMDebugger::setDOMBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDOMBreakpointResponse { | |
} | |
impl Method for SetDOMBreakpoint { | |
const NAME: &'static str = "DOMDebugger.setDOMBreakpoint"; | |
type ReturnObject = SetDOMBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::setEventListenerBreakpoint` command. | |
pub type SetEventListenerBreakpoint = SetEventListenerBreakpointRequest; | |
/// Return object of the `DOMDebugger::setEventListenerBreakpoint` command. | |
pub type SetEventListenerBreakpointReturnObject = SetEventListenerBreakpointResponse; | |
/// Request object of the `DOMDebugger::setEventListenerBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEventListenerBreakpointRequest { | |
/// DOM Event name to stop on (any DOM event will do). | |
pub event_name: String, | |
/// EventTarget interface name to stop on. If equal to `"*"` or not provided, will stop on any | |
/// EventTarget. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub target_name: Option<String>, | |
} | |
/// Response object of the `DOMDebugger::setEventListenerBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEventListenerBreakpointResponse { | |
} | |
impl Method for SetEventListenerBreakpoint { | |
const NAME: &'static str = "DOMDebugger.setEventListenerBreakpoint"; | |
type ReturnObject = SetEventListenerBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::setInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
pub type SetInstrumentationBreakpoint = SetInstrumentationBreakpointRequest; | |
/// Return object of the `DOMDebugger::setInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
pub type SetInstrumentationBreakpointReturnObject = SetInstrumentationBreakpointResponse; | |
/// Request object of the `DOMDebugger::setInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInstrumentationBreakpointRequest { | |
/// Instrumentation name to stop on. | |
pub event_name: String, | |
} | |
/// Response object of the `DOMDebugger::setInstrumentationBreakpoint` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInstrumentationBreakpointResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetInstrumentationBreakpoint { | |
const NAME: &'static str = "DOMDebugger.setInstrumentationBreakpoint"; | |
type ReturnObject = SetInstrumentationBreakpointReturnObject; | |
} | |
/// Method parameters of the `DOMDebugger::setXHRBreakpoint` command. | |
pub type SetXHRBreakpoint = SetXHRBreakpointRequest; | |
/// Return object of the `DOMDebugger::setXHRBreakpoint` command. | |
pub type SetXHRBreakpointReturnObject = SetXHRBreakpointResponse; | |
/// Request object of the `DOMDebugger::setXHRBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetXHRBreakpointRequest { | |
/// Resource URL substring. All XHRs having this substring in the URL will get stopped upon. | |
pub url: String, | |
} | |
/// Response object of the `DOMDebugger::setXHRBreakpoint` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetXHRBreakpointResponse { | |
} | |
impl Method for SetXHRBreakpoint { | |
const NAME: &'static str = "DOMDebugger.setXHRBreakpoint"; | |
type ReturnObject = SetXHRBreakpointReturnObject; | |
} | |
} | |
/// This domain facilitates obtaining document snapshots with DOM, layout, and style information. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_snapshot"))] | |
pub trait DOMSnapshot: CSS + DOM + DOMDebugger + Page { | |
type Error; | |
/// Disables DOM snapshot agent for the given page. | |
fn disable(&mut self) -> Result<(), <Self as DOMSnapshot>::Error>; | |
/// Enables DOM snapshot agent for the given page. | |
fn enable(&mut self) -> Result<(), <Self as DOMSnapshot>::Error>; | |
/// Returns a document snapshot, including the full DOM tree of the root node (including iframes, | |
/// template contents, and imported documents) in a flattened array, as well as layout and | |
/// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is | |
/// flattened. | |
#[deprecated] | |
fn get_snapshot(&mut self, computed_style_whitelist: Vec<String>, include_event_listeners: Option<Boolean>, include_paint_order: Option<Boolean>, include_user_agent_shadow_tree: Option<Boolean>) -> Result<(Vec<dom_snapshot::DOMNode>, Vec<dom_snapshot::LayoutTreeNode>, Vec<dom_snapshot::ComputedStyle>), <Self as DOMSnapshot>::Error>; | |
/// Returns a document snapshot, including the full DOM tree of the root node (including iframes, | |
/// template contents, and imported documents) in a flattened array, as well as layout and | |
/// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is | |
/// flattened. | |
fn capture_snapshot(&mut self, computed_styles: Vec<String>, include_paint_order: Option<Boolean>, include_dom_rects: Option<Boolean>) -> Result<(Vec<dom_snapshot::DocumentSnapshot>, Vec<String>), <Self as DOMSnapshot>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_snapshot"))] | |
impl<T> DOMSnapshot for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as DOMSnapshot>::Error> { | |
CallSite::call(self, dom_snapshot::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as DOMSnapshot>::Error> { | |
CallSite::call(self, dom_snapshot::EnableRequest {}).map(|_| ()) | |
} | |
fn get_snapshot(&mut self, computed_style_whitelist: Vec<String>, include_event_listeners: Option<Boolean>, include_paint_order: Option<Boolean>, include_user_agent_shadow_tree: Option<Boolean>) -> Result<(Vec<dom_snapshot::DOMNode>, Vec<dom_snapshot::LayoutTreeNode>, Vec<dom_snapshot::ComputedStyle>), <Self as DOMSnapshot>::Error> { | |
CallSite::call(self, dom_snapshot::GetSnapshotRequest { computed_style_whitelist, include_event_listeners, include_paint_order, include_user_agent_shadow_tree }).map(|res| (res.dom_nodes, res.layout_tree_nodes, res.computed_styles)) | |
} | |
fn capture_snapshot(&mut self, computed_styles: Vec<String>, include_paint_order: Option<Boolean>, include_dom_rects: Option<Boolean>) -> Result<(Vec<dom_snapshot::DocumentSnapshot>, Vec<String>), <Self as DOMSnapshot>::Error> { | |
CallSite::call(self, dom_snapshot::CaptureSnapshotRequest { computed_styles, include_paint_order, include_dom_rects }).map(|res| (res.documents, res.strings)) | |
} | |
} | |
/// This domain facilitates obtaining document snapshots with DOM, layout, and style information. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_snapshot")))] | |
pub trait AsyncDOMSnapshot: AsyncCSS + AsyncDOM + AsyncDOMDebugger + AsyncPage where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMSnapshot>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMSnapshot>::Error>; | |
type GetSnapshot: futures::Future<Item = ((Vec<dom_snapshot::DOMNode>, Vec<dom_snapshot::LayoutTreeNode>, Vec<dom_snapshot::ComputedStyle>), Self), Error = <Self as AsyncDOMSnapshot>::Error>; | |
type CaptureSnapshot: futures::Future<Item = ((Vec<dom_snapshot::DocumentSnapshot>, Vec<String>), Self), Error = <Self as AsyncDOMSnapshot>::Error>; | |
/// Disables DOM snapshot agent for the given page. | |
fn disable(self) -> <Self as AsyncDOMSnapshot>::Disable; | |
/// Enables DOM snapshot agent for the given page. | |
fn enable(self) -> <Self as AsyncDOMSnapshot>::Enable; | |
/// Returns a document snapshot, including the full DOM tree of the root node (including iframes, | |
/// template contents, and imported documents) in a flattened array, as well as layout and | |
/// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is | |
/// flattened. | |
#[deprecated] | |
fn get_snapshot(self, computed_style_whitelist: Vec<String>, include_event_listeners: Option<Boolean>, include_paint_order: Option<Boolean>, include_user_agent_shadow_tree: Option<Boolean>) -> <Self as AsyncDOMSnapshot>::GetSnapshot; | |
/// Returns a document snapshot, including the full DOM tree of the root node (including iframes, | |
/// template contents, and imported documents) in a flattened array, as well as layout and | |
/// white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is | |
/// flattened. | |
fn capture_snapshot(self, computed_styles: Vec<String>, include_paint_order: Option<Boolean>, include_dom_rects: Option<Boolean>) -> <Self as AsyncDOMSnapshot>::CaptureSnapshot; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_snapshot")))] | |
impl<T> AsyncDOMSnapshot for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetSnapshot = Box<dyn futures::Future<Item = ((Vec<dom_snapshot::DOMNode>, Vec<dom_snapshot::LayoutTreeNode>, Vec<dom_snapshot::ComputedStyle>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CaptureSnapshot = Box<dyn futures::Future<Item = ((Vec<dom_snapshot::DocumentSnapshot>, Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncDOMSnapshot>::Disable { | |
Box::new(AsyncCallSite::async_call(self, dom_snapshot::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncDOMSnapshot>::Enable { | |
Box::new(AsyncCallSite::async_call(self, dom_snapshot::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_snapshot(self, computed_style_whitelist: Vec<String>, include_event_listeners: Option<Boolean>, include_paint_order: Option<Boolean>, include_user_agent_shadow_tree: Option<Boolean>) -> <Self as AsyncDOMSnapshot>::GetSnapshot { | |
Box::new(AsyncCallSite::async_call(self, dom_snapshot::GetSnapshotRequest { computed_style_whitelist, include_event_listeners, include_paint_order, include_user_agent_shadow_tree }).map(|(res, self_)| ((res.dom_nodes, res.layout_tree_nodes, res.computed_styles), self_))) | |
} | |
fn capture_snapshot(self, computed_styles: Vec<String>, include_paint_order: Option<Boolean>, include_dom_rects: Option<Boolean>) -> <Self as AsyncDOMSnapshot>::CaptureSnapshot { | |
Box::new(AsyncCallSite::async_call(self, dom_snapshot::CaptureSnapshotRequest { computed_styles, include_paint_order, include_dom_rects }).map(|(res, self_)| ((res.documents, res.strings), self_))) | |
} | |
} | |
/// This domain facilitates obtaining document snapshots with DOM, layout, and style information. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_snapshot"))] | |
#[allow(deprecated)] | |
pub mod dom_snapshot { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// A Node in the DOM tree. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DOMNode { | |
/// `Node`'s nodeType. | |
pub node_type: Integer, | |
/// `Node`'s nodeName. | |
pub node_name: String, | |
/// `Node`'s nodeValue. | |
pub node_value: String, | |
/// Only set for textarea elements, contains the text value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub text_value: Option<String>, | |
/// Only set for input elements, contains the input's associated text value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub input_value: Option<String>, | |
/// Only set for radio and checkbox input elements, indicates if the element has been checked | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub input_checked: Option<Boolean>, | |
/// Only set for option elements, indicates if the element has been selected | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub option_selected: Option<Boolean>, | |
/// `Node`'s id, corresponds to DOM.Node.backendNodeId. | |
pub backend_node_id: dom::BackendNodeId, | |
/// The indexes of the node's child nodes in the `domNodes` array returned by `getSnapshot`, if | |
/// any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub child_node_indexes: Option<Vec<Integer>>, | |
/// Attributes of an `Element` node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attributes: Option<Vec<NameValue>>, | |
/// Indexes of pseudo elements associated with this node in the `domNodes` array returned by | |
/// `getSnapshot`, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_element_indexes: Option<Vec<Integer>>, | |
/// The index of the node's related layout tree node in the `layoutTreeNodes` array returned by | |
/// `getSnapshot`, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub layout_node_index: Option<Integer>, | |
/// Document URL that `Document` or `FrameOwner` node points to. | |
#[serde(rename = "documentURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub document_url: Option<String>, | |
/// Base URL that `Document` or `FrameOwner` node uses for URL completion. | |
#[serde(rename = "baseURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub base_url: Option<String>, | |
/// Only set for documents, contains the document's content language. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_language: Option<String>, | |
/// Only set for documents, contains the document's character set encoding. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub document_encoding: Option<String>, | |
/// `DocumentType` node's publicId. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub public_id: Option<String>, | |
/// `DocumentType` node's systemId. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub system_id: Option<String>, | |
/// Frame ID for frame owner elements and also for the document node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_id: Option<page::FrameId>, | |
/// The index of a frame owner element's content document in the `domNodes` array returned by | |
/// `getSnapshot`, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_document_index: Option<Integer>, | |
/// Type of a pseudo element node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_type: Option<dom::PseudoType>, | |
/// Shadow root type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shadow_root_type: Option<dom::ShadowRootType>, | |
/// Whether this DOM node responds to mouse clicks. This includes nodes that have had click | |
/// event listeners attached via JavaScript as well as anchor tags that naturally navigate when | |
/// clicked. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_clickable: Option<Boolean>, | |
/// Details of the node's event listeners, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub event_listeners: Option<Vec<dom_debugger::EventListener>>, | |
/// The selected url for nodes with a srcset attribute. | |
#[serde(rename = "currentSourceURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub current_source_url: Option<String>, | |
/// The url of the script (if any) that generates this node. | |
#[serde(rename = "originURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub origin_url: Option<String>, | |
/// Scroll offsets, set when this node is a Document. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_offset_x: Option<Number>, | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_offset_y: Option<Number>, | |
} | |
/// Details of post layout rendered text positions. The exact layout should not be regarded as | |
/// stable and may change between versions. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InlineTextBox { | |
/// The bounding box in document coordinates. Note that scroll offset of the document is ignored. | |
pub bounding_box: dom::Rect, | |
/// The starting index in characters, for this post layout textbox substring. Characters that | |
/// would be represented as a surrogate pair in UTF-16 have length 2. | |
pub start_character_index: Integer, | |
/// The number of characters in this post layout textbox substring. Characters that would be | |
/// represented as a surrogate pair in UTF-16 have length 2. | |
pub num_characters: Integer, | |
} | |
/// Details of an element in the DOM tree with a LayoutObject. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LayoutTreeNode { | |
/// The index of the related DOM node in the `domNodes` array returned by `getSnapshot`. | |
pub dom_node_index: Integer, | |
/// The bounding box in document coordinates. Note that scroll offset of the document is ignored. | |
pub bounding_box: dom::Rect, | |
/// Contents of the LayoutText, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub layout_text: Option<String>, | |
/// The post-layout inline text nodes, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub inline_text_nodes: Option<Vec<InlineTextBox>>, | |
/// Index into the `computedStyles` array returned by `getSnapshot`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub style_index: Option<Integer>, | |
/// Global paint order index, which is determined by the stacking order of the nodes. Nodes | |
/// that are painted together will have the same index. Only provided if includePaintOrder in | |
/// getSnapshot was true. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub paint_order: Option<Integer>, | |
/// Set to true to indicate the element begins a new stacking context. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_stacking_context: Option<Boolean>, | |
} | |
/// A subset of the full ComputedStyle as defined by the request whitelist. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ComputedStyle { | |
/// Name/value pairs of computed style properties. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub properties: Vec<NameValue>, | |
} | |
/// A name/value pair. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NameValue { | |
/// Attribute/property name. | |
pub name: String, | |
/// Attribute/property value. | |
pub value: String, | |
} | |
/// Index of the string in the strings table. | |
pub type StringIndex = Integer; | |
/// Index of the string in the strings table. | |
pub type ArrayOfStrings = Vec<StringIndex>; | |
/// Data that is only present on rare nodes. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RareStringData { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub index: Vec<Integer>, | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub value: Vec<StringIndex>, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RareBooleanData { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub index: Vec<Integer>, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RareIntegerData { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub index: Vec<Integer>, | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub value: Vec<Integer>, | |
} | |
pub type Rectangle = Vec<Number>; | |
/// Document snapshot. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DocumentSnapshot { | |
/// Document URL that `Document` or `FrameOwner` node points to. | |
#[serde(rename = "documentURL")] | |
pub document_url: StringIndex, | |
/// Base URL that `Document` or `FrameOwner` node uses for URL completion. | |
#[serde(rename = "baseURL")] | |
pub base_url: StringIndex, | |
/// Contains the document's content language. | |
pub content_language: StringIndex, | |
/// Contains the document's character set encoding. | |
pub encoding_name: StringIndex, | |
/// `DocumentType` node's publicId. | |
pub public_id: StringIndex, | |
/// `DocumentType` node's systemId. | |
pub system_id: StringIndex, | |
/// Frame ID for frame owner elements and also for the document node. | |
pub frame_id: StringIndex, | |
/// A table with dom nodes. | |
pub nodes: NodeTreeSnapshot, | |
/// The nodes in the layout tree. | |
pub layout: LayoutTreeSnapshot, | |
/// The post-layout inline text nodes. | |
pub text_boxes: TextBoxSnapshot, | |
/// Horizontal scroll offset. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_offset_x: Option<Number>, | |
/// Vertical scroll offset. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_offset_y: Option<Number>, | |
} | |
/// Table containing nodes. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NodeTreeSnapshot { | |
/// Parent node index. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub parent_index: Option<Vec<Integer>>, | |
/// `Node`'s nodeType. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_type: Option<Vec<Integer>>, | |
/// `Node`'s nodeName. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_name: Option<Vec<StringIndex>>, | |
/// `Node`'s nodeValue. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_value: Option<Vec<StringIndex>>, | |
/// `Node`'s id, corresponds to DOM.Node.backendNodeId. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<Vec<dom::BackendNodeId>>, | |
/// Attributes of an `Element` node. Flatten name, value pairs. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub attributes: Option<Vec<ArrayOfStrings>>, | |
/// Only set for textarea elements, contains the text value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub text_value: Option<RareStringData>, | |
/// Only set for input elements, contains the input's associated text value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub input_value: Option<RareStringData>, | |
/// Only set for radio and checkbox input elements, indicates if the element has been checked | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub input_checked: Option<RareBooleanData>, | |
/// Only set for option elements, indicates if the element has been selected | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub option_selected: Option<RareBooleanData>, | |
/// The index of the document in the list of the snapshot documents. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_document_index: Option<RareIntegerData>, | |
/// Type of a pseudo element node. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pseudo_type: Option<RareStringData>, | |
/// Whether this DOM node responds to mouse clicks. This includes nodes that have had click | |
/// event listeners attached via JavaScript as well as anchor tags that naturally navigate when | |
/// clicked. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_clickable: Option<RareBooleanData>, | |
/// The selected url for nodes with a srcset attribute. | |
#[serde(rename = "currentSourceURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub current_source_url: Option<RareStringData>, | |
/// The url of the script (if any) that generates this node. | |
#[serde(rename = "originURL")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub origin_url: Option<RareStringData>, | |
} | |
/// Table of details of an element in the DOM tree with a LayoutObject. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LayoutTreeSnapshot { | |
/// Index of the corresponding node in the `NodeTreeSnapshot` array returned by `captureSnapshot`. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub node_index: Vec<Integer>, | |
/// Array of indexes specifying computed style strings, filtered according to the `computedStyles` parameter passed to `captureSnapshot`. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub styles: Vec<ArrayOfStrings>, | |
/// The absolute position bounding box. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub bounds: Vec<Rectangle>, | |
/// Contents of the LayoutText, if any. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub text: Vec<StringIndex>, | |
/// Stacking context information. | |
pub stacking_contexts: RareBooleanData, | |
/// Global paint order index, which is determined by the stacking order of the nodes. Nodes | |
/// that are painted together will have the same index. Only provided if includePaintOrder in | |
/// captureSnapshot was true. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub paint_orders: Option<Vec<Integer>>, | |
/// The offset rect of nodes. Only available when includeDOMRects is set to true | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub offset_rects: Option<Vec<Rectangle>>, | |
/// The scroll rect of nodes. Only available when includeDOMRects is set to true | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_rects: Option<Vec<Rectangle>>, | |
/// The client rect of nodes. Only available when includeDOMRects is set to true | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub client_rects: Option<Vec<Rectangle>>, | |
} | |
/// Table of details of the post layout rendered text positions. The exact layout should not be regarded as | |
/// stable and may change between versions. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TextBoxSnapshot { | |
/// Index of the layout tree node that owns this box collection. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub layout_index: Vec<Integer>, | |
/// The absolute position bounding box. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub bounds: Vec<Rectangle>, | |
/// The starting index in characters, for this post layout textbox substring. Characters that | |
/// would be represented as a surrogate pair in UTF-16 have length 2. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub start: Vec<Integer>, | |
/// The number of characters in this post layout textbox substring. Characters that would be | |
/// represented as a surrogate pair in UTF-16 have length 2. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub length: Vec<Integer>, | |
} | |
/// Method parameters of the `DOMSnapshot::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `DOMSnapshot::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `DOMSnapshot::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `DOMSnapshot::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "DOMSnapshot.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `DOMSnapshot::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `DOMSnapshot::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `DOMSnapshot::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `DOMSnapshot::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "DOMSnapshot.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `DOMSnapshot::getSnapshot` command. | |
#[deprecated] | |
pub type GetSnapshot = GetSnapshotRequest; | |
/// Return object of the `DOMSnapshot::getSnapshot` command. | |
#[deprecated] | |
pub type GetSnapshotReturnObject = GetSnapshotResponse; | |
/// Request object of the `DOMSnapshot::getSnapshot` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSnapshotRequest { | |
/// Whitelist of computed styles to return. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub computed_style_whitelist: Vec<String>, | |
/// Whether or not to retrieve details of DOM listeners (default false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_event_listeners: Option<Boolean>, | |
/// Whether to determine and include the paint order index of LayoutTreeNodes (default false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_paint_order: Option<Boolean>, | |
/// Whether to include UA shadow tree in the snapshot (default false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_user_agent_shadow_tree: Option<Boolean>, | |
} | |
/// Response object of the `DOMSnapshot::getSnapshot` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSnapshotResponse { | |
/// The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub dom_nodes: Vec<DOMNode>, | |
/// The nodes in the layout tree. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub layout_tree_nodes: Vec<LayoutTreeNode>, | |
/// Whitelisted ComputedStyle properties for each node in the layout tree. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub computed_styles: Vec<ComputedStyle>, | |
} | |
impl Method for GetSnapshot { | |
const NAME: &'static str = "DOMSnapshot.getSnapshot"; | |
type ReturnObject = GetSnapshotReturnObject; | |
} | |
/// Method parameters of the `DOMSnapshot::captureSnapshot` command. | |
pub type CaptureSnapshot = CaptureSnapshotRequest; | |
/// Return object of the `DOMSnapshot::captureSnapshot` command. | |
pub type CaptureSnapshotReturnObject = CaptureSnapshotResponse; | |
/// Request object of the `DOMSnapshot::captureSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureSnapshotRequest { | |
/// Whitelist of computed styles to return. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub computed_styles: Vec<String>, | |
/// Whether to include layout object paint orders into the snapshot. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_paint_order: Option<Boolean>, | |
/// Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot | |
#[serde(rename = "includeDOMRects")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_dom_rects: Option<Boolean>, | |
} | |
/// Response object of the `DOMSnapshot::captureSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureSnapshotResponse { | |
/// The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub documents: Vec<DocumentSnapshot>, | |
/// Shared string table that all string properties refer to with indexes. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub strings: Vec<String>, | |
} | |
impl Method for CaptureSnapshot { | |
const NAME: &'static str = "DOMSnapshot.captureSnapshot"; | |
type ReturnObject = CaptureSnapshotReturnObject; | |
} | |
} | |
/// Query and modify DOM storage. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_storage"))] | |
pub trait DOMStorage { | |
type Error; | |
fn clear(&mut self, storage_id: dom_storage::StorageId) -> Result<(), <Self as DOMStorage>::Error>; | |
/// Disables storage tracking, prevents storage events from being sent to the client. | |
fn disable(&mut self) -> Result<(), <Self as DOMStorage>::Error>; | |
/// Enables storage tracking, storage events will now be delivered to the client. | |
fn enable(&mut self) -> Result<(), <Self as DOMStorage>::Error>; | |
fn get_dom_storage_items(&mut self, storage_id: dom_storage::StorageId) -> Result<(Vec<dom_storage::Item>), <Self as DOMStorage>::Error>; | |
fn remove_dom_storage_item(&mut self, storage_id: dom_storage::StorageId, key: String) -> Result<(), <Self as DOMStorage>::Error>; | |
fn set_dom_storage_item(&mut self, storage_id: dom_storage::StorageId, key: String, value: String) -> Result<(), <Self as DOMStorage>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_storage"))] | |
impl<T> DOMStorage for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn clear(&mut self, storage_id: dom_storage::StorageId) -> Result<(), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::ClearRequest { storage_id }).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::EnableRequest {}).map(|_| ()) | |
} | |
fn get_dom_storage_items(&mut self, storage_id: dom_storage::StorageId) -> Result<(Vec<dom_storage::Item>), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::GetDOMStorageItemsRequest { storage_id }).map(|res| (res.entries)) | |
} | |
fn remove_dom_storage_item(&mut self, storage_id: dom_storage::StorageId, key: String) -> Result<(), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::RemoveDOMStorageItemRequest { storage_id, key }).map(|_| ()) | |
} | |
fn set_dom_storage_item(&mut self, storage_id: dom_storage::StorageId, key: String, value: String) -> Result<(), <Self as DOMStorage>::Error> { | |
CallSite::call(self, dom_storage::SetDOMStorageItemRequest { storage_id, key, value }).map(|_| ()) | |
} | |
} | |
/// Query and modify DOM storage. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_storage")))] | |
pub trait AsyncDOMStorage where Self: Sized { | |
type Error; | |
type Clear: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
type GetDOMStorageItems: futures::Future<Item = ((Vec<dom_storage::Item>), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
type RemoveDOMStorageItem: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
type SetDOMStorageItem: futures::Future<Item = ((), Self), Error = <Self as AsyncDOMStorage>::Error>; | |
fn clear(self, storage_id: dom_storage::StorageId) -> <Self as AsyncDOMStorage>::Clear; | |
/// Disables storage tracking, prevents storage events from being sent to the client. | |
fn disable(self) -> <Self as AsyncDOMStorage>::Disable; | |
/// Enables storage tracking, storage events will now be delivered to the client. | |
fn enable(self) -> <Self as AsyncDOMStorage>::Enable; | |
fn get_dom_storage_items(self, storage_id: dom_storage::StorageId) -> <Self as AsyncDOMStorage>::GetDOMStorageItems; | |
fn remove_dom_storage_item(self, storage_id: dom_storage::StorageId, key: String) -> <Self as AsyncDOMStorage>::RemoveDOMStorageItem; | |
fn set_dom_storage_item(self, storage_id: dom_storage::StorageId, key: String, value: String) -> <Self as AsyncDOMStorage>::SetDOMStorageItem; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "dom_storage")))] | |
impl<T> AsyncDOMStorage for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Clear = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetDOMStorageItems = Box<dyn futures::Future<Item = ((Vec<dom_storage::Item>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveDOMStorageItem = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDOMStorageItem = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn clear(self, storage_id: dom_storage::StorageId) -> <Self as AsyncDOMStorage>::Clear { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::ClearRequest { storage_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncDOMStorage>::Disable { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncDOMStorage>::Enable { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_dom_storage_items(self, storage_id: dom_storage::StorageId) -> <Self as AsyncDOMStorage>::GetDOMStorageItems { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::GetDOMStorageItemsRequest { storage_id }).map(|(res, self_)| ((res.entries), self_))) | |
} | |
fn remove_dom_storage_item(self, storage_id: dom_storage::StorageId, key: String) -> <Self as AsyncDOMStorage>::RemoveDOMStorageItem { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::RemoveDOMStorageItemRequest { storage_id, key }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_dom_storage_item(self, storage_id: dom_storage::StorageId, key: String, value: String) -> <Self as AsyncDOMStorage>::SetDOMStorageItem { | |
Box::new(AsyncCallSite::async_call(self, dom_storage::SetDOMStorageItemRequest { storage_id, key, value }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// Query and modify DOM storage. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "dom_storage"))] | |
#[allow(deprecated)] | |
pub mod dom_storage { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// DOM Storage identifier. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StorageId { | |
/// Security origin for the storage. | |
pub security_origin: String, | |
/// Whether the storage is local storage (not session storage). | |
pub is_local_storage: Boolean, | |
} | |
/// DOM Storage item. | |
pub type Item = Vec<String>; | |
/// Method parameters of the `DOMStorage::clear` command. | |
pub type Clear = ClearRequest; | |
/// Return object of the `DOMStorage::clear` command. | |
pub type ClearReturnObject = ClearResponse; | |
/// Request object of the `DOMStorage::clear` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearRequest { | |
pub storage_id: StorageId, | |
} | |
/// Response object of the `DOMStorage::clear` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearResponse { | |
} | |
impl Method for Clear { | |
const NAME: &'static str = "DOMStorage.clear"; | |
type ReturnObject = ClearReturnObject; | |
} | |
/// Method parameters of the `DOMStorage::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `DOMStorage::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `DOMStorage::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `DOMStorage::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "DOMStorage.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `DOMStorage::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `DOMStorage::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `DOMStorage::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `DOMStorage::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "DOMStorage.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `DOMStorage::getDOMStorageItems` command. | |
pub type GetDOMStorageItems = GetDOMStorageItemsRequest; | |
/// Return object of the `DOMStorage::getDOMStorageItems` command. | |
pub type GetDOMStorageItemsReturnObject = GetDOMStorageItemsResponse; | |
/// Request object of the `DOMStorage::getDOMStorageItems` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDOMStorageItemsRequest { | |
pub storage_id: StorageId, | |
} | |
/// Response object of the `DOMStorage::getDOMStorageItems` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDOMStorageItemsResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub entries: Vec<Item>, | |
} | |
impl Method for GetDOMStorageItems { | |
const NAME: &'static str = "DOMStorage.getDOMStorageItems"; | |
type ReturnObject = GetDOMStorageItemsReturnObject; | |
} | |
/// Method parameters of the `DOMStorage::removeDOMStorageItem` command. | |
pub type RemoveDOMStorageItem = RemoveDOMStorageItemRequest; | |
/// Return object of the `DOMStorage::removeDOMStorageItem` command. | |
pub type RemoveDOMStorageItemReturnObject = RemoveDOMStorageItemResponse; | |
/// Request object of the `DOMStorage::removeDOMStorageItem` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveDOMStorageItemRequest { | |
pub storage_id: StorageId, | |
pub key: String, | |
} | |
/// Response object of the `DOMStorage::removeDOMStorageItem` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveDOMStorageItemResponse { | |
} | |
impl Method for RemoveDOMStorageItem { | |
const NAME: &'static str = "DOMStorage.removeDOMStorageItem"; | |
type ReturnObject = RemoveDOMStorageItemReturnObject; | |
} | |
/// Method parameters of the `DOMStorage::setDOMStorageItem` command. | |
pub type SetDOMStorageItem = SetDOMStorageItemRequest; | |
/// Return object of the `DOMStorage::setDOMStorageItem` command. | |
pub type SetDOMStorageItemReturnObject = SetDOMStorageItemResponse; | |
/// Request object of the `DOMStorage::setDOMStorageItem` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDOMStorageItemRequest { | |
pub storage_id: StorageId, | |
pub key: String, | |
pub value: String, | |
} | |
/// Response object of the `DOMStorage::setDOMStorageItem` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDOMStorageItemResponse { | |
} | |
impl Method for SetDOMStorageItem { | |
const NAME: &'static str = "DOMStorage.setDOMStorageItem"; | |
type ReturnObject = SetDOMStorageItemReturnObject; | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DomStorageItemAddedEvent { | |
pub storage_id: StorageId, | |
pub key: String, | |
pub new_value: String, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DomStorageItemRemovedEvent { | |
pub storage_id: StorageId, | |
pub key: String, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DomStorageItemUpdatedEvent { | |
pub storage_id: StorageId, | |
pub key: String, | |
pub old_value: String, | |
pub new_value: String, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DomStorageItemsClearedEvent { | |
pub storage_id: StorageId, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
#[serde(rename = "DOMStorage.domStorageItemAdded")] | |
DomStorageItemAdded(DomStorageItemAddedEvent), | |
#[serde(rename = "DOMStorage.domStorageItemRemoved")] | |
DomStorageItemRemoved(DomStorageItemRemovedEvent), | |
#[serde(rename = "DOMStorage.domStorageItemUpdated")] | |
DomStorageItemUpdated(DomStorageItemUpdatedEvent), | |
#[serde(rename = "DOMStorage.domStorageItemsCleared")] | |
DomStorageItemsCleared(DomStorageItemsClearedEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "database"))] | |
pub trait Database { | |
type Error; | |
/// Disables database tracking, prevents database events from being sent to the client. | |
fn disable(&mut self) -> Result<(), <Self as Database>::Error>; | |
/// Enables database tracking, database events will now be delivered to the client. | |
fn enable(&mut self) -> Result<(), <Self as Database>::Error>; | |
fn execute_sql(&mut self, database_id: database::DatabaseId, query: String) -> Result<(Option<Vec<String>>, Option<Vec<Any>>, Option<database::Error>), <Self as Database>::Error>; | |
fn get_database_table_names(&mut self, database_id: database::DatabaseId) -> Result<(Vec<String>), <Self as Database>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "database"))] | |
impl<T> Database for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as Database>::Error> { | |
CallSite::call(self, database::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Database>::Error> { | |
CallSite::call(self, database::EnableRequest {}).map(|_| ()) | |
} | |
fn execute_sql(&mut self, database_id: database::DatabaseId, query: String) -> Result<(Option<Vec<String>>, Option<Vec<Any>>, Option<database::Error>), <Self as Database>::Error> { | |
CallSite::call(self, database::ExecuteSQLRequest { database_id, query }).map(|res| (res.column_names, res.values, res.sql_error)) | |
} | |
fn get_database_table_names(&mut self, database_id: database::DatabaseId) -> Result<(Vec<String>), <Self as Database>::Error> { | |
CallSite::call(self, database::GetDatabaseTableNamesRequest { database_id }).map(|res| (res.table_names)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "database")))] | |
pub trait AsyncDatabase where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncDatabase>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncDatabase>::Error>; | |
type ExecuteSQL: futures::Future<Item = ((Option<Vec<String>>, Option<Vec<Any>>, Option<database::Error>), Self), Error = <Self as AsyncDatabase>::Error>; | |
type GetDatabaseTableNames: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncDatabase>::Error>; | |
/// Disables database tracking, prevents database events from being sent to the client. | |
fn disable(self) -> <Self as AsyncDatabase>::Disable; | |
/// Enables database tracking, database events will now be delivered to the client. | |
fn enable(self) -> <Self as AsyncDatabase>::Enable; | |
fn execute_sql(self, database_id: database::DatabaseId, query: String) -> <Self as AsyncDatabase>::ExecuteSQL; | |
fn get_database_table_names(self, database_id: database::DatabaseId) -> <Self as AsyncDatabase>::GetDatabaseTableNames; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "database")))] | |
impl<T> AsyncDatabase for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ExecuteSQL = Box<dyn futures::Future<Item = ((Option<Vec<String>>, Option<Vec<Any>>, Option<database::Error>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetDatabaseTableNames = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncDatabase>::Disable { | |
Box::new(AsyncCallSite::async_call(self, database::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncDatabase>::Enable { | |
Box::new(AsyncCallSite::async_call(self, database::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn execute_sql(self, database_id: database::DatabaseId, query: String) -> <Self as AsyncDatabase>::ExecuteSQL { | |
Box::new(AsyncCallSite::async_call(self, database::ExecuteSQLRequest { database_id, query }).map(|(res, self_)| ((res.column_names, res.values, res.sql_error), self_))) | |
} | |
fn get_database_table_names(self, database_id: database::DatabaseId) -> <Self as AsyncDatabase>::GetDatabaseTableNames { | |
Box::new(AsyncCallSite::async_call(self, database::GetDatabaseTableNamesRequest { database_id }).map(|(res, self_)| ((res.table_names), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "database"))] | |
#[allow(deprecated)] | |
pub mod database { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique identifier of Database object. | |
pub type DatabaseId = String; | |
/// Database object. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Database { | |
/// Database ID. | |
pub id: DatabaseId, | |
/// Database domain. | |
pub domain: String, | |
/// Database name. | |
pub name: String, | |
/// Database version. | |
pub version: String, | |
} | |
/// Database error. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Error { | |
/// Error message. | |
pub message: String, | |
/// Error code. | |
pub code: Integer, | |
} | |
/// Method parameters of the `Database::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Database::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Database::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Database::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Database.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Database::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Database::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Database::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Database::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Database.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Database::executeSQL` command. | |
pub type ExecuteSQL = ExecuteSQLRequest; | |
/// Return object of the `Database::executeSQL` command. | |
pub type ExecuteSQLReturnObject = ExecuteSQLResponse; | |
/// Request object of the `Database::executeSQL` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ExecuteSQLRequest { | |
pub database_id: DatabaseId, | |
pub query: String, | |
} | |
/// Response object of the `Database::executeSQL` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ExecuteSQLResponse { | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub column_names: Option<Vec<String>>, | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub values: Option<Vec<Any>>, | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sql_error: Option<Error>, | |
} | |
impl Method for ExecuteSQL { | |
const NAME: &'static str = "Database.executeSQL"; | |
type ReturnObject = ExecuteSQLReturnObject; | |
} | |
/// Method parameters of the `Database::getDatabaseTableNames` command. | |
pub type GetDatabaseTableNames = GetDatabaseTableNamesRequest; | |
/// Return object of the `Database::getDatabaseTableNames` command. | |
pub type GetDatabaseTableNamesReturnObject = GetDatabaseTableNamesResponse; | |
/// Request object of the `Database::getDatabaseTableNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDatabaseTableNamesRequest { | |
pub database_id: DatabaseId, | |
} | |
/// Response object of the `Database::getDatabaseTableNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDatabaseTableNamesResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub table_names: Vec<String>, | |
} | |
impl Method for GetDatabaseTableNames { | |
const NAME: &'static str = "Database.getDatabaseTableNames"; | |
type ReturnObject = GetDatabaseTableNamesReturnObject; | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddDatabaseEvent { | |
pub database: Database, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
#[serde(rename = "Database.addDatabase")] | |
AddDatabase(AddDatabaseEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "device_orientation"))] | |
pub trait DeviceOrientation { | |
type Error; | |
/// Clears the overridden Device Orientation. | |
fn clear_device_orientation_override(&mut self) -> Result<(), <Self as DeviceOrientation>::Error>; | |
/// Overrides the Device Orientation. | |
fn set_device_orientation_override(&mut self, alpha: Number, beta: Number, gamma: Number) -> Result<(), <Self as DeviceOrientation>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "device_orientation"))] | |
impl<T> DeviceOrientation for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn clear_device_orientation_override(&mut self) -> Result<(), <Self as DeviceOrientation>::Error> { | |
CallSite::call(self, device_orientation::ClearDeviceOrientationOverrideRequest {}).map(|_| ()) | |
} | |
fn set_device_orientation_override(&mut self, alpha: Number, beta: Number, gamma: Number) -> Result<(), <Self as DeviceOrientation>::Error> { | |
CallSite::call(self, device_orientation::SetDeviceOrientationOverrideRequest { alpha, beta, gamma }).map(|_| ()) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "device_orientation")))] | |
pub trait AsyncDeviceOrientation where Self: Sized { | |
type Error; | |
type ClearDeviceOrientationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncDeviceOrientation>::Error>; | |
type SetDeviceOrientationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncDeviceOrientation>::Error>; | |
/// Clears the overridden Device Orientation. | |
fn clear_device_orientation_override(self) -> <Self as AsyncDeviceOrientation>::ClearDeviceOrientationOverride; | |
/// Overrides the Device Orientation. | |
fn set_device_orientation_override(self, alpha: Number, beta: Number, gamma: Number) -> <Self as AsyncDeviceOrientation>::SetDeviceOrientationOverride; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "device_orientation")))] | |
impl<T> AsyncDeviceOrientation for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type ClearDeviceOrientationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDeviceOrientationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn clear_device_orientation_override(self) -> <Self as AsyncDeviceOrientation>::ClearDeviceOrientationOverride { | |
Box::new(AsyncCallSite::async_call(self, device_orientation::ClearDeviceOrientationOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn set_device_orientation_override(self, alpha: Number, beta: Number, gamma: Number) -> <Self as AsyncDeviceOrientation>::SetDeviceOrientationOverride { | |
Box::new(AsyncCallSite::async_call(self, device_orientation::SetDeviceOrientationOverrideRequest { alpha, beta, gamma }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "device_orientation"))] | |
#[allow(deprecated)] | |
pub mod device_orientation { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Method parameters of the `DeviceOrientation::clearDeviceOrientationOverride` command. | |
pub type ClearDeviceOrientationOverride = ClearDeviceOrientationOverrideRequest; | |
/// Return object of the `DeviceOrientation::clearDeviceOrientationOverride` command. | |
pub type ClearDeviceOrientationOverrideReturnObject = ClearDeviceOrientationOverrideResponse; | |
/// Request object of the `DeviceOrientation::clearDeviceOrientationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceOrientationOverrideRequest { | |
} | |
/// Response object of the `DeviceOrientation::clearDeviceOrientationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceOrientationOverrideResponse { | |
} | |
impl Method for ClearDeviceOrientationOverride { | |
const NAME: &'static str = "DeviceOrientation.clearDeviceOrientationOverride"; | |
type ReturnObject = ClearDeviceOrientationOverrideReturnObject; | |
} | |
/// Method parameters of the `DeviceOrientation::setDeviceOrientationOverride` command. | |
pub type SetDeviceOrientationOverride = SetDeviceOrientationOverrideRequest; | |
/// Return object of the `DeviceOrientation::setDeviceOrientationOverride` command. | |
pub type SetDeviceOrientationOverrideReturnObject = SetDeviceOrientationOverrideResponse; | |
/// Request object of the `DeviceOrientation::setDeviceOrientationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDeviceOrientationOverrideRequest { | |
/// Mock alpha | |
pub alpha: Number, | |
/// Mock beta | |
pub beta: Number, | |
/// Mock gamma | |
pub gamma: Number, | |
} | |
/// Response object of the `DeviceOrientation::setDeviceOrientationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDeviceOrientationOverrideResponse { | |
} | |
impl Method for SetDeviceOrientationOverride { | |
const NAME: &'static str = "DeviceOrientation.setDeviceOrientationOverride"; | |
type ReturnObject = SetDeviceOrientationOverrideReturnObject; | |
} | |
} | |
/// This domain emulates different environments for the page. | |
#[cfg(any(feature = "all", feature = "emulation"))] | |
pub trait Emulation: DOM + Page + Runtime { | |
type Error; | |
/// Tells whether emulation is supported. | |
fn can_emulate(&mut self) -> Result<(Boolean), <Self as Emulation>::Error>; | |
/// Clears the overriden device metrics. | |
fn clear_device_metrics_override(&mut self) -> Result<(), <Self as Emulation>::Error>; | |
/// Clears the overriden Geolocation Position and Error. | |
fn clear_geolocation_override(&mut self) -> Result<(), <Self as Emulation>::Error>; | |
/// Requests that page scale factor is reset to initial values. | |
#[cfg(feature = "experimental")] | |
fn reset_page_scale_factor(&mut self) -> Result<(), <Self as Emulation>::Error>; | |
/// Enables or disables simulating a focused and active page. | |
#[cfg(feature = "experimental")] | |
fn set_focus_emulation_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Emulation>::Error>; | |
/// Enables CPU throttling to emulate slow CPUs. | |
#[cfg(feature = "experimental")] | |
fn set_cpu_throttling_rate(&mut self, rate: Number) -> Result<(), <Self as Emulation>::Error>; | |
/// Sets or clears an override of the default background color of the frame. This override is used | |
/// if the content does not specify one. | |
fn set_default_background_color_override(&mut self, color: Option<dom::RGBA>) -> Result<(), <Self as Emulation>::Error>; | |
/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height, | |
/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media | |
/// query results). | |
fn set_device_metrics_override(&mut self, req: emulation::SetDeviceMetricsOverrideRequest) -> Result<(), <Self as Emulation>::Error>; | |
#[cfg(feature = "experimental")] | |
fn set_scrollbars_hidden(&mut self, hidden: Boolean) -> Result<(), <Self as Emulation>::Error>; | |
#[cfg(feature = "experimental")] | |
fn set_document_cookie_disabled(&mut self, disabled: Boolean) -> Result<(), <Self as Emulation>::Error>; | |
#[cfg(feature = "experimental")] | |
fn set_emit_touch_events_for_mouse(&mut self, enabled: Boolean, configuration: Option<emulation::SetEmitTouchEventsForMouseRequestConfiguration>) -> Result<(), <Self as Emulation>::Error>; | |
/// Emulates the given media for CSS media queries. | |
fn set_emulated_media(&mut self, media: String) -> Result<(), <Self as Emulation>::Error>; | |
/// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position | |
/// unavailable. | |
fn set_geolocation_override(&mut self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> Result<(), <Self as Emulation>::Error>; | |
/// Overrides value returned by the javascript navigator object. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_navigator_overrides(&mut self, platform: String) -> Result<(), <Self as Emulation>::Error>; | |
/// Sets a specified page scale factor. | |
#[cfg(feature = "experimental")] | |
fn set_page_scale_factor(&mut self, page_scale_factor: Number) -> Result<(), <Self as Emulation>::Error>; | |
/// Switches script execution in the page. | |
fn set_script_execution_disabled(&mut self, value: Boolean) -> Result<(), <Self as Emulation>::Error>; | |
/// Enables touch on platforms which do not support them. | |
fn set_touch_emulation_enabled(&mut self, enabled: Boolean, max_touch_points: Option<Integer>) -> Result<(), <Self as Emulation>::Error>; | |
/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets | |
/// the current virtual time policy. Note this supersedes any previous time budget. | |
#[cfg(feature = "experimental")] | |
fn set_virtual_time_policy(&mut self, policy: emulation::VirtualTimePolicy, budget: Option<Number>, max_virtual_time_task_starvation_count: Option<Integer>, wait_for_navigation: Option<Boolean>, initial_virtual_time: Option<network::TimeSinceEpoch>) -> Result<(Number), <Self as Emulation>::Error>; | |
/// Overrides default host system timezone with the specified one. | |
#[cfg(feature = "experimental")] | |
fn set_timezone_override(&mut self, timezone_id: String) -> Result<(), <Self as Emulation>::Error>; | |
/// Resizes the frame/viewport of the page. Note that this does not affect the frame's container | |
/// (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported | |
/// on Android. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_visible_size(&mut self, width: Integer, height: Integer) -> Result<(), <Self as Emulation>::Error>; | |
/// Allows overriding user agent with the given string. | |
fn set_user_agent_override(&mut self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> Result<(), <Self as Emulation>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "emulation"))] | |
impl<T> Emulation for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn can_emulate(&mut self) -> Result<(Boolean), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::CanEmulateRequest {}).map(|res| (res.result)) | |
} | |
fn clear_device_metrics_override(&mut self) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::ClearDeviceMetricsOverrideRequest {}).map(|_| ()) | |
} | |
fn clear_geolocation_override(&mut self) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::ClearGeolocationOverrideRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn reset_page_scale_factor(&mut self) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::ResetPageScaleFactorRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_focus_emulation_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetFocusEmulationEnabledRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_cpu_throttling_rate(&mut self, rate: Number) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetCPUThrottlingRateRequest { rate }).map(|_| ()) | |
} | |
fn set_default_background_color_override(&mut self, color: Option<dom::RGBA>) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetDefaultBackgroundColorOverrideRequest { color }).map(|_| ()) | |
} | |
fn set_device_metrics_override(&mut self, req: emulation::SetDeviceMetricsOverrideRequest) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_scrollbars_hidden(&mut self, hidden: Boolean) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetScrollbarsHiddenRequest { hidden }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_document_cookie_disabled(&mut self, disabled: Boolean) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetDocumentCookieDisabledRequest { disabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_emit_touch_events_for_mouse(&mut self, enabled: Boolean, configuration: Option<emulation::SetEmitTouchEventsForMouseRequestConfiguration>) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetEmitTouchEventsForMouseRequest { enabled, configuration }).map(|_| ()) | |
} | |
fn set_emulated_media(&mut self, media: String) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetEmulatedMediaRequest { media }).map(|_| ()) | |
} | |
fn set_geolocation_override(&mut self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetGeolocationOverrideRequest { latitude, longitude, accuracy }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_navigator_overrides(&mut self, platform: String) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetNavigatorOverridesRequest { platform }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_page_scale_factor(&mut self, page_scale_factor: Number) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetPageScaleFactorRequest { page_scale_factor }).map(|_| ()) | |
} | |
fn set_script_execution_disabled(&mut self, value: Boolean) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetScriptExecutionDisabledRequest { value }).map(|_| ()) | |
} | |
fn set_touch_emulation_enabled(&mut self, enabled: Boolean, max_touch_points: Option<Integer>) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetTouchEmulationEnabledRequest { enabled, max_touch_points }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_virtual_time_policy(&mut self, policy: emulation::VirtualTimePolicy, budget: Option<Number>, max_virtual_time_task_starvation_count: Option<Integer>, wait_for_navigation: Option<Boolean>, initial_virtual_time: Option<network::TimeSinceEpoch>) -> Result<(Number), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetVirtualTimePolicyRequest { policy, budget, max_virtual_time_task_starvation_count, wait_for_navigation, initial_virtual_time }).map(|res| (res.virtual_time_ticks_base)) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_timezone_override(&mut self, timezone_id: String) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetTimezoneOverrideRequest { timezone_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_visible_size(&mut self, width: Integer, height: Integer) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetVisibleSizeRequest { width, height }).map(|_| ()) | |
} | |
fn set_user_agent_override(&mut self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> Result<(), <Self as Emulation>::Error> { | |
CallSite::call(self, emulation::SetUserAgentOverrideRequest { user_agent, accept_language, platform }).map(|_| ()) | |
} | |
} | |
/// This domain emulates different environments for the page. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "emulation")))] | |
pub trait AsyncEmulation: AsyncDOM + AsyncPage + AsyncRuntime where Self: Sized { | |
type Error; | |
type CanEmulate: futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncEmulation>::Error>; | |
type ClearDeviceMetricsOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type ClearGeolocationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type ResetPageScaleFactor: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetFocusEmulationEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetCPUThrottlingRate: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetDefaultBackgroundColorOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetDeviceMetricsOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetScrollbarsHidden: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDocumentCookieDisabled: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetEmitTouchEventsForMouse: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetEmulatedMedia: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetGeolocationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetNavigatorOverrides: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetPageScaleFactor: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetScriptExecutionDisabled: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetTouchEmulationEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetVirtualTimePolicy: futures::Future<Item = ((Number), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetTimezoneOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetVisibleSize: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
type SetUserAgentOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncEmulation>::Error>; | |
/// Tells whether emulation is supported. | |
fn can_emulate(self) -> <Self as AsyncEmulation>::CanEmulate; | |
/// Clears the overriden device metrics. | |
fn clear_device_metrics_override(self) -> <Self as AsyncEmulation>::ClearDeviceMetricsOverride; | |
/// Clears the overriden Geolocation Position and Error. | |
fn clear_geolocation_override(self) -> <Self as AsyncEmulation>::ClearGeolocationOverride; | |
/// Requests that page scale factor is reset to initial values. | |
#[cfg(feature = "experimental")] | |
fn reset_page_scale_factor(self) -> <Self as AsyncEmulation>::ResetPageScaleFactor; | |
/// Enables or disables simulating a focused and active page. | |
#[cfg(feature = "experimental")] | |
fn set_focus_emulation_enabled(self, enabled: Boolean) -> <Self as AsyncEmulation>::SetFocusEmulationEnabled; | |
/// Enables CPU throttling to emulate slow CPUs. | |
#[cfg(feature = "experimental")] | |
fn set_cpu_throttling_rate(self, rate: Number) -> <Self as AsyncEmulation>::SetCPUThrottlingRate; | |
/// Sets or clears an override of the default background color of the frame. This override is used | |
/// if the content does not specify one. | |
fn set_default_background_color_override(self, color: Option<dom::RGBA>) -> <Self as AsyncEmulation>::SetDefaultBackgroundColorOverride; | |
/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height, | |
/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media | |
/// query results). | |
fn set_device_metrics_override(self, req: emulation::SetDeviceMetricsOverrideRequest) -> <Self as AsyncEmulation>::SetDeviceMetricsOverride; | |
#[cfg(feature = "experimental")] | |
fn set_scrollbars_hidden(self, hidden: Boolean) -> <Self as AsyncEmulation>::SetScrollbarsHidden; | |
#[cfg(feature = "experimental")] | |
fn set_document_cookie_disabled(self, disabled: Boolean) -> <Self as AsyncEmulation>::SetDocumentCookieDisabled; | |
#[cfg(feature = "experimental")] | |
fn set_emit_touch_events_for_mouse(self, enabled: Boolean, configuration: Option<emulation::SetEmitTouchEventsForMouseRequestConfiguration>) -> <Self as AsyncEmulation>::SetEmitTouchEventsForMouse; | |
/// Emulates the given media for CSS media queries. | |
fn set_emulated_media(self, media: String) -> <Self as AsyncEmulation>::SetEmulatedMedia; | |
/// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position | |
/// unavailable. | |
fn set_geolocation_override(self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> <Self as AsyncEmulation>::SetGeolocationOverride; | |
/// Overrides value returned by the javascript navigator object. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_navigator_overrides(self, platform: String) -> <Self as AsyncEmulation>::SetNavigatorOverrides; | |
/// Sets a specified page scale factor. | |
#[cfg(feature = "experimental")] | |
fn set_page_scale_factor(self, page_scale_factor: Number) -> <Self as AsyncEmulation>::SetPageScaleFactor; | |
/// Switches script execution in the page. | |
fn set_script_execution_disabled(self, value: Boolean) -> <Self as AsyncEmulation>::SetScriptExecutionDisabled; | |
/// Enables touch on platforms which do not support them. | |
fn set_touch_emulation_enabled(self, enabled: Boolean, max_touch_points: Option<Integer>) -> <Self as AsyncEmulation>::SetTouchEmulationEnabled; | |
/// Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets | |
/// the current virtual time policy. Note this supersedes any previous time budget. | |
#[cfg(feature = "experimental")] | |
fn set_virtual_time_policy(self, policy: emulation::VirtualTimePolicy, budget: Option<Number>, max_virtual_time_task_starvation_count: Option<Integer>, wait_for_navigation: Option<Boolean>, initial_virtual_time: Option<network::TimeSinceEpoch>) -> <Self as AsyncEmulation>::SetVirtualTimePolicy; | |
/// Overrides default host system timezone with the specified one. | |
#[cfg(feature = "experimental")] | |
fn set_timezone_override(self, timezone_id: String) -> <Self as AsyncEmulation>::SetTimezoneOverride; | |
/// Resizes the frame/viewport of the page. Note that this does not affect the frame's container | |
/// (e.g. browser window). Can be used to produce screenshots of the specified size. Not supported | |
/// on Android. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_visible_size(self, width: Integer, height: Integer) -> <Self as AsyncEmulation>::SetVisibleSize; | |
/// Allows overriding user agent with the given string. | |
fn set_user_agent_override(self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> <Self as AsyncEmulation>::SetUserAgentOverride; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "emulation")))] | |
impl<T> AsyncEmulation for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type CanEmulate = Box<dyn futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearDeviceMetricsOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearGeolocationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ResetPageScaleFactor = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetFocusEmulationEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetCPUThrottlingRate = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDefaultBackgroundColorOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDeviceMetricsOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetScrollbarsHidden = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDocumentCookieDisabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetEmitTouchEventsForMouse = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetEmulatedMedia = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetGeolocationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetNavigatorOverrides = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetPageScaleFactor = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetScriptExecutionDisabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetTouchEmulationEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetVirtualTimePolicy = Box<dyn futures::Future<Item = ((Number), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetTimezoneOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetVisibleSize = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetUserAgentOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn can_emulate(self) -> <Self as AsyncEmulation>::CanEmulate { | |
Box::new(AsyncCallSite::async_call(self, emulation::CanEmulateRequest {}).map(|(res, self_)| ((res.result), self_))) | |
} | |
fn clear_device_metrics_override(self) -> <Self as AsyncEmulation>::ClearDeviceMetricsOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::ClearDeviceMetricsOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn clear_geolocation_override(self) -> <Self as AsyncEmulation>::ClearGeolocationOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::ClearGeolocationOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn reset_page_scale_factor(self) -> <Self as AsyncEmulation>::ResetPageScaleFactor { | |
Box::new(AsyncCallSite::async_call(self, emulation::ResetPageScaleFactorRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_focus_emulation_enabled(self, enabled: Boolean) -> <Self as AsyncEmulation>::SetFocusEmulationEnabled { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetFocusEmulationEnabledRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_cpu_throttling_rate(self, rate: Number) -> <Self as AsyncEmulation>::SetCPUThrottlingRate { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetCPUThrottlingRateRequest { rate }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_default_background_color_override(self, color: Option<dom::RGBA>) -> <Self as AsyncEmulation>::SetDefaultBackgroundColorOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetDefaultBackgroundColorOverrideRequest { color }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_device_metrics_override(self, req: emulation::SetDeviceMetricsOverrideRequest) -> <Self as AsyncEmulation>::SetDeviceMetricsOverride { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_scrollbars_hidden(self, hidden: Boolean) -> <Self as AsyncEmulation>::SetScrollbarsHidden { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetScrollbarsHiddenRequest { hidden }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_document_cookie_disabled(self, disabled: Boolean) -> <Self as AsyncEmulation>::SetDocumentCookieDisabled { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetDocumentCookieDisabledRequest { disabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_emit_touch_events_for_mouse(self, enabled: Boolean, configuration: Option<emulation::SetEmitTouchEventsForMouseRequestConfiguration>) -> <Self as AsyncEmulation>::SetEmitTouchEventsForMouse { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetEmitTouchEventsForMouseRequest { enabled, configuration }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_emulated_media(self, media: String) -> <Self as AsyncEmulation>::SetEmulatedMedia { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetEmulatedMediaRequest { media }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_geolocation_override(self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> <Self as AsyncEmulation>::SetGeolocationOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetGeolocationOverrideRequest { latitude, longitude, accuracy }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_navigator_overrides(self, platform: String) -> <Self as AsyncEmulation>::SetNavigatorOverrides { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetNavigatorOverridesRequest { platform }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_page_scale_factor(self, page_scale_factor: Number) -> <Self as AsyncEmulation>::SetPageScaleFactor { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetPageScaleFactorRequest { page_scale_factor }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_script_execution_disabled(self, value: Boolean) -> <Self as AsyncEmulation>::SetScriptExecutionDisabled { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetScriptExecutionDisabledRequest { value }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_touch_emulation_enabled(self, enabled: Boolean, max_touch_points: Option<Integer>) -> <Self as AsyncEmulation>::SetTouchEmulationEnabled { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetTouchEmulationEnabledRequest { enabled, max_touch_points }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_virtual_time_policy(self, policy: emulation::VirtualTimePolicy, budget: Option<Number>, max_virtual_time_task_starvation_count: Option<Integer>, wait_for_navigation: Option<Boolean>, initial_virtual_time: Option<network::TimeSinceEpoch>) -> <Self as AsyncEmulation>::SetVirtualTimePolicy { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetVirtualTimePolicyRequest { policy, budget, max_virtual_time_task_starvation_count, wait_for_navigation, initial_virtual_time }).map(|(res, self_)| ((res.virtual_time_ticks_base), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_timezone_override(self, timezone_id: String) -> <Self as AsyncEmulation>::SetTimezoneOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetTimezoneOverrideRequest { timezone_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_visible_size(self, width: Integer, height: Integer) -> <Self as AsyncEmulation>::SetVisibleSize { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetVisibleSizeRequest { width, height }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_user_agent_override(self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> <Self as AsyncEmulation>::SetUserAgentOverride { | |
Box::new(AsyncCallSite::async_call(self, emulation::SetUserAgentOverrideRequest { user_agent, accept_language, platform }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// This domain emulates different environments for the page. | |
#[cfg(any(feature = "all", feature = "emulation"))] | |
#[allow(deprecated)] | |
pub mod emulation { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Screen orientation. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ScreenOrientation { | |
/// Orientation type. | |
#[serde(rename = "type")] | |
pub r#type: ScreenOrientationType, | |
/// Orientation angle. | |
pub angle: Integer, | |
} | |
/// Allow values for the `ScreenOrientation::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ScreenOrientationType { | |
PortraitPrimary, | |
PortraitSecondary, | |
LandscapePrimary, | |
LandscapeSecondary, | |
} | |
/// advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to | |
/// allow the next delayed task (if any) to run; pause: The virtual time base may not advance; | |
/// pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending | |
/// resource fetches. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum VirtualTimePolicy { | |
Advance, | |
Pause, | |
PauseIfNetworkFetchesPending, | |
} | |
/// Method parameters of the `Emulation::canEmulate` command. | |
pub type CanEmulate = CanEmulateRequest; | |
/// Return object of the `Emulation::canEmulate` command. | |
pub type CanEmulateReturnObject = CanEmulateResponse; | |
/// Request object of the `Emulation::canEmulate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanEmulateRequest { | |
} | |
/// Response object of the `Emulation::canEmulate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanEmulateResponse { | |
/// True if emulation is supported. | |
pub result: Boolean, | |
} | |
impl Method for CanEmulate { | |
const NAME: &'static str = "Emulation.canEmulate"; | |
type ReturnObject = CanEmulateReturnObject; | |
} | |
/// Method parameters of the `Emulation::clearDeviceMetricsOverride` command. | |
pub type ClearDeviceMetricsOverride = ClearDeviceMetricsOverrideRequest; | |
/// Return object of the `Emulation::clearDeviceMetricsOverride` command. | |
pub type ClearDeviceMetricsOverrideReturnObject = ClearDeviceMetricsOverrideResponse; | |
/// Request object of the `Emulation::clearDeviceMetricsOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceMetricsOverrideRequest { | |
} | |
/// Response object of the `Emulation::clearDeviceMetricsOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceMetricsOverrideResponse { | |
} | |
impl Method for ClearDeviceMetricsOverride { | |
const NAME: &'static str = "Emulation.clearDeviceMetricsOverride"; | |
type ReturnObject = ClearDeviceMetricsOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::clearGeolocationOverride` command. | |
pub type ClearGeolocationOverride = ClearGeolocationOverrideRequest; | |
/// Return object of the `Emulation::clearGeolocationOverride` command. | |
pub type ClearGeolocationOverrideReturnObject = ClearGeolocationOverrideResponse; | |
/// Request object of the `Emulation::clearGeolocationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearGeolocationOverrideRequest { | |
} | |
/// Response object of the `Emulation::clearGeolocationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearGeolocationOverrideResponse { | |
} | |
impl Method for ClearGeolocationOverride { | |
const NAME: &'static str = "Emulation.clearGeolocationOverride"; | |
type ReturnObject = ClearGeolocationOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::resetPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
pub type ResetPageScaleFactor = ResetPageScaleFactorRequest; | |
/// Return object of the `Emulation::resetPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
pub type ResetPageScaleFactorReturnObject = ResetPageScaleFactorResponse; | |
/// Request object of the `Emulation::resetPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetPageScaleFactorRequest { | |
} | |
/// Response object of the `Emulation::resetPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetPageScaleFactorResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ResetPageScaleFactor { | |
const NAME: &'static str = "Emulation.resetPageScaleFactor"; | |
type ReturnObject = ResetPageScaleFactorReturnObject; | |
} | |
/// Method parameters of the `Emulation::setFocusEmulationEnabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetFocusEmulationEnabled = SetFocusEmulationEnabledRequest; | |
/// Return object of the `Emulation::setFocusEmulationEnabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetFocusEmulationEnabledReturnObject = SetFocusEmulationEnabledResponse; | |
/// Request object of the `Emulation::setFocusEmulationEnabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetFocusEmulationEnabledRequest { | |
/// Whether to enable to disable focus emulation. | |
pub enabled: Boolean, | |
} | |
/// Response object of the `Emulation::setFocusEmulationEnabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetFocusEmulationEnabledResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetFocusEmulationEnabled { | |
const NAME: &'static str = "Emulation.setFocusEmulationEnabled"; | |
type ReturnObject = SetFocusEmulationEnabledReturnObject; | |
} | |
/// Method parameters of the `Emulation::setCPUThrottlingRate` command. | |
#[cfg(feature = "experimental")] | |
pub type SetCPUThrottlingRate = SetCPUThrottlingRateRequest; | |
/// Return object of the `Emulation::setCPUThrottlingRate` command. | |
#[cfg(feature = "experimental")] | |
pub type SetCPUThrottlingRateReturnObject = SetCPUThrottlingRateResponse; | |
/// Request object of the `Emulation::setCPUThrottlingRate` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCPUThrottlingRateRequest { | |
/// Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). | |
pub rate: Number, | |
} | |
/// Response object of the `Emulation::setCPUThrottlingRate` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCPUThrottlingRateResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetCPUThrottlingRate { | |
const NAME: &'static str = "Emulation.setCPUThrottlingRate"; | |
type ReturnObject = SetCPUThrottlingRateReturnObject; | |
} | |
/// Method parameters of the `Emulation::setDefaultBackgroundColorOverride` command. | |
pub type SetDefaultBackgroundColorOverride = SetDefaultBackgroundColorOverrideRequest; | |
/// Return object of the `Emulation::setDefaultBackgroundColorOverride` command. | |
pub type SetDefaultBackgroundColorOverrideReturnObject = SetDefaultBackgroundColorOverrideResponse; | |
/// Request object of the `Emulation::setDefaultBackgroundColorOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDefaultBackgroundColorOverrideRequest { | |
/// RGBA of the default background color. If not specified, any existing override will be | |
/// cleared. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub color: Option<dom::RGBA>, | |
} | |
/// Response object of the `Emulation::setDefaultBackgroundColorOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDefaultBackgroundColorOverrideResponse { | |
} | |
impl Method for SetDefaultBackgroundColorOverride { | |
const NAME: &'static str = "Emulation.setDefaultBackgroundColorOverride"; | |
type ReturnObject = SetDefaultBackgroundColorOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::setDeviceMetricsOverride` command. | |
pub type SetDeviceMetricsOverride = SetDeviceMetricsOverrideRequest; | |
/// Return object of the `Emulation::setDeviceMetricsOverride` command. | |
pub type SetDeviceMetricsOverrideReturnObject = SetDeviceMetricsOverrideResponse; | |
/// Request object of the `Emulation::setDeviceMetricsOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDeviceMetricsOverrideRequest { | |
/// Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. | |
pub width: Integer, | |
/// Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. | |
pub height: Integer, | |
/// Overriding device scale factor value. 0 disables the override. | |
pub device_scale_factor: Number, | |
/// Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text | |
/// autosizing and more. | |
pub mobile: Boolean, | |
/// Scale to apply to resulting view image. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scale: Option<Number>, | |
/// Overriding screen width value in pixels (minimum 0, maximum 10000000). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub screen_width: Option<Integer>, | |
/// Overriding screen height value in pixels (minimum 0, maximum 10000000). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub screen_height: Option<Integer>, | |
/// Overriding view X position on screen in pixels (minimum 0, maximum 10000000). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub position_x: Option<Integer>, | |
/// Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub position_y: Option<Integer>, | |
/// Do not set visible view size, rely upon explicit setVisibleSize call. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub dont_set_visible_size: Option<Boolean>, | |
/// Screen orientation override. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub screen_orientation: Option<ScreenOrientation>, | |
/// If set, the visible area of the page will be overridden to this viewport. This viewport | |
/// change is not observed by the page, e.g. viewport-relative elements do not change positions. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub viewport: Option<page::Viewport>, | |
} | |
/// Response object of the `Emulation::setDeviceMetricsOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDeviceMetricsOverrideResponse { | |
} | |
impl Method for SetDeviceMetricsOverride { | |
const NAME: &'static str = "Emulation.setDeviceMetricsOverride"; | |
type ReturnObject = SetDeviceMetricsOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::setScrollbarsHidden` command. | |
#[cfg(feature = "experimental")] | |
pub type SetScrollbarsHidden = SetScrollbarsHiddenRequest; | |
/// Return object of the `Emulation::setScrollbarsHidden` command. | |
#[cfg(feature = "experimental")] | |
pub type SetScrollbarsHiddenReturnObject = SetScrollbarsHiddenResponse; | |
/// Request object of the `Emulation::setScrollbarsHidden` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetScrollbarsHiddenRequest { | |
/// Whether scrollbars should be always hidden. | |
pub hidden: Boolean, | |
} | |
/// Response object of the `Emulation::setScrollbarsHidden` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetScrollbarsHiddenResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetScrollbarsHidden { | |
const NAME: &'static str = "Emulation.setScrollbarsHidden"; | |
type ReturnObject = SetScrollbarsHiddenReturnObject; | |
} | |
/// Method parameters of the `Emulation::setDocumentCookieDisabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDocumentCookieDisabled = SetDocumentCookieDisabledRequest; | |
/// Return object of the `Emulation::setDocumentCookieDisabled` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDocumentCookieDisabledReturnObject = SetDocumentCookieDisabledResponse; | |
/// Request object of the `Emulation::setDocumentCookieDisabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDocumentCookieDisabledRequest { | |
/// Whether document.coookie API should be disabled. | |
pub disabled: Boolean, | |
} | |
/// Response object of the `Emulation::setDocumentCookieDisabled` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDocumentCookieDisabledResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetDocumentCookieDisabled { | |
const NAME: &'static str = "Emulation.setDocumentCookieDisabled"; | |
type ReturnObject = SetDocumentCookieDisabledReturnObject; | |
} | |
/// Method parameters of the `Emulation::setEmitTouchEventsForMouse` command. | |
#[cfg(feature = "experimental")] | |
pub type SetEmitTouchEventsForMouse = SetEmitTouchEventsForMouseRequest; | |
/// Return object of the `Emulation::setEmitTouchEventsForMouse` command. | |
#[cfg(feature = "experimental")] | |
pub type SetEmitTouchEventsForMouseReturnObject = SetEmitTouchEventsForMouseResponse; | |
/// Request object of the `Emulation::setEmitTouchEventsForMouse` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEmitTouchEventsForMouseRequest { | |
/// Whether touch emulation based on mouse input should be enabled. | |
pub enabled: Boolean, | |
/// Touch/gesture events configuration. Default: current platform. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub configuration: Option<SetEmitTouchEventsForMouseRequestConfiguration>, | |
} | |
/// Allow values for the `SetEmitTouchEventsForMouseRequest::configuration` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum SetEmitTouchEventsForMouseRequestConfiguration { | |
Mobile, | |
Desktop, | |
} | |
/// Response object of the `Emulation::setEmitTouchEventsForMouse` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEmitTouchEventsForMouseResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetEmitTouchEventsForMouse { | |
const NAME: &'static str = "Emulation.setEmitTouchEventsForMouse"; | |
type ReturnObject = SetEmitTouchEventsForMouseReturnObject; | |
} | |
/// Method parameters of the `Emulation::setEmulatedMedia` command. | |
pub type SetEmulatedMedia = SetEmulatedMediaRequest; | |
/// Return object of the `Emulation::setEmulatedMedia` command. | |
pub type SetEmulatedMediaReturnObject = SetEmulatedMediaResponse; | |
/// Request object of the `Emulation::setEmulatedMedia` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEmulatedMediaRequest { | |
/// Media type to emulate. Empty string disables the override. | |
pub media: String, | |
} | |
/// Response object of the `Emulation::setEmulatedMedia` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetEmulatedMediaResponse { | |
} | |
impl Method for SetEmulatedMedia { | |
const NAME: &'static str = "Emulation.setEmulatedMedia"; | |
type ReturnObject = SetEmulatedMediaReturnObject; | |
} | |
/// Method parameters of the `Emulation::setGeolocationOverride` command. | |
pub type SetGeolocationOverride = SetGeolocationOverrideRequest; | |
/// Return object of the `Emulation::setGeolocationOverride` command. | |
pub type SetGeolocationOverrideReturnObject = SetGeolocationOverrideResponse; | |
/// Request object of the `Emulation::setGeolocationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetGeolocationOverrideRequest { | |
/// Mock latitude | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub latitude: Option<Number>, | |
/// Mock longitude | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub longitude: Option<Number>, | |
/// Mock accuracy | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub accuracy: Option<Number>, | |
} | |
/// Response object of the `Emulation::setGeolocationOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetGeolocationOverrideResponse { | |
} | |
impl Method for SetGeolocationOverride { | |
const NAME: &'static str = "Emulation.setGeolocationOverride"; | |
type ReturnObject = SetGeolocationOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::setNavigatorOverrides` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetNavigatorOverrides = SetNavigatorOverridesRequest; | |
/// Return object of the `Emulation::setNavigatorOverrides` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetNavigatorOverridesReturnObject = SetNavigatorOverridesResponse; | |
/// Request object of the `Emulation::setNavigatorOverrides` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNavigatorOverridesRequest { | |
/// The platform navigator.platform should return. | |
pub platform: String, | |
} | |
/// Response object of the `Emulation::setNavigatorOverrides` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetNavigatorOverridesResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetNavigatorOverrides { | |
const NAME: &'static str = "Emulation.setNavigatorOverrides"; | |
type ReturnObject = SetNavigatorOverridesReturnObject; | |
} | |
/// Method parameters of the `Emulation::setPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
pub type SetPageScaleFactor = SetPageScaleFactorRequest; | |
/// Return object of the `Emulation::setPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
pub type SetPageScaleFactorReturnObject = SetPageScaleFactorResponse; | |
/// Request object of the `Emulation::setPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPageScaleFactorRequest { | |
/// Page scale factor. | |
pub page_scale_factor: Number, | |
} | |
/// Response object of the `Emulation::setPageScaleFactor` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPageScaleFactorResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetPageScaleFactor { | |
const NAME: &'static str = "Emulation.setPageScaleFactor"; | |
type ReturnObject = SetPageScaleFactorReturnObject; | |
} | |
/// Method parameters of the `Emulation::setScriptExecutionDisabled` command. | |
pub type SetScriptExecutionDisabled = SetScriptExecutionDisabledRequest; | |
/// Return object of the `Emulation::setScriptExecutionDisabled` command. | |
pub type SetScriptExecutionDisabledReturnObject = SetScriptExecutionDisabledResponse; | |
/// Request object of the `Emulation::setScriptExecutionDisabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetScriptExecutionDisabledRequest { | |
/// Whether script execution should be disabled in the page. | |
pub value: Boolean, | |
} | |
/// Response object of the `Emulation::setScriptExecutionDisabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetScriptExecutionDisabledResponse { | |
} | |
impl Method for SetScriptExecutionDisabled { | |
const NAME: &'static str = "Emulation.setScriptExecutionDisabled"; | |
type ReturnObject = SetScriptExecutionDisabledReturnObject; | |
} | |
/// Method parameters of the `Emulation::setTouchEmulationEnabled` command. | |
pub type SetTouchEmulationEnabled = SetTouchEmulationEnabledRequest; | |
/// Return object of the `Emulation::setTouchEmulationEnabled` command. | |
pub type SetTouchEmulationEnabledReturnObject = SetTouchEmulationEnabledResponse; | |
/// Request object of the `Emulation::setTouchEmulationEnabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTouchEmulationEnabledRequest { | |
/// Whether the touch event emulation should be enabled. | |
pub enabled: Boolean, | |
/// Maximum touch points supported. Defaults to one. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub max_touch_points: Option<Integer>, | |
} | |
/// Response object of the `Emulation::setTouchEmulationEnabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTouchEmulationEnabledResponse { | |
} | |
impl Method for SetTouchEmulationEnabled { | |
const NAME: &'static str = "Emulation.setTouchEmulationEnabled"; | |
type ReturnObject = SetTouchEmulationEnabledReturnObject; | |
} | |
/// Method parameters of the `Emulation::setVirtualTimePolicy` command. | |
#[cfg(feature = "experimental")] | |
pub type SetVirtualTimePolicy = SetVirtualTimePolicyRequest; | |
/// Return object of the `Emulation::setVirtualTimePolicy` command. | |
#[cfg(feature = "experimental")] | |
pub type SetVirtualTimePolicyReturnObject = SetVirtualTimePolicyResponse; | |
/// Request object of the `Emulation::setVirtualTimePolicy` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetVirtualTimePolicyRequest { | |
pub policy: VirtualTimePolicy, | |
/// If set, after this many virtual milliseconds have elapsed virtual time will be paused and a | |
/// virtualTimeBudgetExpired event is sent. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub budget: Option<Number>, | |
/// If set this specifies the maximum number of tasks that can be run before virtual is forced | |
/// forwards to prevent deadlock. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub max_virtual_time_task_starvation_count: Option<Integer>, | |
/// If set the virtual time policy change should be deferred until any frame starts navigating. | |
/// Note any previous deferred policy change is superseded. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub wait_for_navigation: Option<Boolean>, | |
/// If set, base::Time::Now will be overriden to initially return this value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub initial_virtual_time: Option<network::TimeSinceEpoch>, | |
} | |
/// Response object of the `Emulation::setVirtualTimePolicy` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetVirtualTimePolicyResponse { | |
/// Absolute timestamp at which virtual time was first enabled (up time in milliseconds). | |
pub virtual_time_ticks_base: Number, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetVirtualTimePolicy { | |
const NAME: &'static str = "Emulation.setVirtualTimePolicy"; | |
type ReturnObject = SetVirtualTimePolicyReturnObject; | |
} | |
/// Method parameters of the `Emulation::setTimezoneOverride` command. | |
#[cfg(feature = "experimental")] | |
pub type SetTimezoneOverride = SetTimezoneOverrideRequest; | |
/// Return object of the `Emulation::setTimezoneOverride` command. | |
#[cfg(feature = "experimental")] | |
pub type SetTimezoneOverrideReturnObject = SetTimezoneOverrideResponse; | |
/// Request object of the `Emulation::setTimezoneOverride` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTimezoneOverrideRequest { | |
/// The timezone identifier. If empty, disables the override and | |
/// restores default host system timezone. | |
pub timezone_id: String, | |
} | |
/// Response object of the `Emulation::setTimezoneOverride` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetTimezoneOverrideResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetTimezoneOverride { | |
const NAME: &'static str = "Emulation.setTimezoneOverride"; | |
type ReturnObject = SetTimezoneOverrideReturnObject; | |
} | |
/// Method parameters of the `Emulation::setVisibleSize` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetVisibleSize = SetVisibleSizeRequest; | |
/// Return object of the `Emulation::setVisibleSize` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetVisibleSizeReturnObject = SetVisibleSizeResponse; | |
/// Request object of the `Emulation::setVisibleSize` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetVisibleSizeRequest { | |
/// Frame width (DIP). | |
pub width: Integer, | |
/// Frame height (DIP). | |
pub height: Integer, | |
} | |
/// Response object of the `Emulation::setVisibleSize` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetVisibleSizeResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetVisibleSize { | |
const NAME: &'static str = "Emulation.setVisibleSize"; | |
type ReturnObject = SetVisibleSizeReturnObject; | |
} | |
/// Method parameters of the `Emulation::setUserAgentOverride` command. | |
pub type SetUserAgentOverride = SetUserAgentOverrideRequest; | |
/// Return object of the `Emulation::setUserAgentOverride` command. | |
pub type SetUserAgentOverrideReturnObject = SetUserAgentOverrideResponse; | |
/// Request object of the `Emulation::setUserAgentOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetUserAgentOverrideRequest { | |
/// User agent to use. | |
pub user_agent: String, | |
/// Browser langugage to emulate. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub accept_language: Option<String>, | |
/// The platform navigator.platform should return. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub platform: Option<String>, | |
} | |
/// Response object of the `Emulation::setUserAgentOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetUserAgentOverrideResponse { | |
} | |
impl Method for SetUserAgentOverride { | |
const NAME: &'static str = "Emulation.setUserAgentOverride"; | |
type ReturnObject = SetUserAgentOverrideReturnObject; | |
} | |
/// Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct VirtualTimeBudgetExpiredEvent { | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Notification sent after the virtual time budget for the current VirtualTimePolicy has run out. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "Emulation.virtualTimeBudgetExpired")] | |
VirtualTimeBudgetExpired(VirtualTimeBudgetExpiredEvent), | |
} | |
} | |
/// This domain provides experimental commands only supported in headless mode. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "headless_experimental"))] | |
pub trait HeadlessExperimental: Page + Runtime { | |
type Error; | |
/// Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a | |
/// screenshot from the resulting frame. Requires that the target was created with enabled | |
/// BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also | |
/// https://goo.gl/3zHXhB for more background. | |
fn begin_frame(&mut self, frame_time_ticks: Option<Number>, interval: Option<Number>, no_display_updates: Option<Boolean>, screenshot: Option<headless_experimental::ScreenshotParams>) -> Result<(Boolean, Option<Binary>), <Self as HeadlessExperimental>::Error>; | |
/// Disables headless events for the target. | |
fn disable(&mut self) -> Result<(), <Self as HeadlessExperimental>::Error>; | |
/// Enables headless events for the target. | |
fn enable(&mut self) -> Result<(), <Self as HeadlessExperimental>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "headless_experimental"))] | |
impl<T> HeadlessExperimental for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn begin_frame(&mut self, frame_time_ticks: Option<Number>, interval: Option<Number>, no_display_updates: Option<Boolean>, screenshot: Option<headless_experimental::ScreenshotParams>) -> Result<(Boolean, Option<Binary>), <Self as HeadlessExperimental>::Error> { | |
CallSite::call(self, headless_experimental::BeginFrameRequest { frame_time_ticks, interval, no_display_updates, screenshot }).map(|res| (res.has_damage, res.screenshot_data)) | |
} | |
fn disable(&mut self) -> Result<(), <Self as HeadlessExperimental>::Error> { | |
CallSite::call(self, headless_experimental::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as HeadlessExperimental>::Error> { | |
CallSite::call(self, headless_experimental::EnableRequest {}).map(|_| ()) | |
} | |
} | |
/// This domain provides experimental commands only supported in headless mode. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "headless_experimental")))] | |
pub trait AsyncHeadlessExperimental: AsyncPage + AsyncRuntime where Self: Sized { | |
type Error; | |
type BeginFrame: futures::Future<Item = ((Boolean, Option<Binary>), Self), Error = <Self as AsyncHeadlessExperimental>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncHeadlessExperimental>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncHeadlessExperimental>::Error>; | |
/// Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a | |
/// screenshot from the resulting frame. Requires that the target was created with enabled | |
/// BeginFrameControl. Designed for use with --run-all-compositor-stages-before-draw, see also | |
/// https://goo.gl/3zHXhB for more background. | |
fn begin_frame(self, frame_time_ticks: Option<Number>, interval: Option<Number>, no_display_updates: Option<Boolean>, screenshot: Option<headless_experimental::ScreenshotParams>) -> <Self as AsyncHeadlessExperimental>::BeginFrame; | |
/// Disables headless events for the target. | |
fn disable(self) -> <Self as AsyncHeadlessExperimental>::Disable; | |
/// Enables headless events for the target. | |
fn enable(self) -> <Self as AsyncHeadlessExperimental>::Enable; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "headless_experimental")))] | |
impl<T> AsyncHeadlessExperimental for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type BeginFrame = Box<dyn futures::Future<Item = ((Boolean, Option<Binary>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn begin_frame(self, frame_time_ticks: Option<Number>, interval: Option<Number>, no_display_updates: Option<Boolean>, screenshot: Option<headless_experimental::ScreenshotParams>) -> <Self as AsyncHeadlessExperimental>::BeginFrame { | |
Box::new(AsyncCallSite::async_call(self, headless_experimental::BeginFrameRequest { frame_time_ticks, interval, no_display_updates, screenshot }).map(|(res, self_)| ((res.has_damage, res.screenshot_data), self_))) | |
} | |
fn disable(self) -> <Self as AsyncHeadlessExperimental>::Disable { | |
Box::new(AsyncCallSite::async_call(self, headless_experimental::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncHeadlessExperimental>::Enable { | |
Box::new(AsyncCallSite::async_call(self, headless_experimental::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// This domain provides experimental commands only supported in headless mode. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "headless_experimental"))] | |
#[allow(deprecated)] | |
pub mod headless_experimental { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Encoding options for a screenshot. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ScreenshotParams { | |
/// Image compression format (defaults to png). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub format: Option<ScreenshotParamsFormat>, | |
/// Compression quality from range [0..100] (jpeg only). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub quality: Option<Integer>, | |
} | |
/// Allow values for the `ScreenshotParams::format` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ScreenshotParamsFormat { | |
Jpeg, | |
Png, | |
} | |
/// Method parameters of the `HeadlessExperimental::beginFrame` command. | |
pub type BeginFrame = BeginFrameRequest; | |
/// Return object of the `HeadlessExperimental::beginFrame` command. | |
pub type BeginFrameReturnObject = BeginFrameResponse; | |
/// Request object of the `HeadlessExperimental::beginFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BeginFrameRequest { | |
/// Timestamp of this BeginFrame in Renderer TimeTicks (milliseconds of uptime). If not set, | |
/// the current time will be used. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_time_ticks: Option<Number>, | |
/// The interval between BeginFrames that is reported to the compositor, in milliseconds. | |
/// Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub interval: Option<Number>, | |
/// Whether updates should not be committed and drawn onto the display. False by default. If | |
/// true, only side effects of the BeginFrame will be run, such as layout and animations, but | |
/// any visual updates may not be visible on the display or in screenshots. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub no_display_updates: Option<Boolean>, | |
/// If set, a screenshot of the frame will be captured and returned in the response. Otherwise, | |
/// no screenshot will be captured. Note that capturing a screenshot can fail, for example, | |
/// during renderer initialization. In such a case, no screenshot data will be returned. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub screenshot: Option<ScreenshotParams>, | |
} | |
/// Response object of the `HeadlessExperimental::beginFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BeginFrameResponse { | |
/// Whether the BeginFrame resulted in damage and, thus, a new frame was committed to the | |
/// display. Reported for diagnostic uses, may be removed in the future. | |
pub has_damage: Boolean, | |
/// Base64-encoded image data of the screenshot, if one was requested and successfully taken. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub screenshot_data: Option<Binary>, | |
} | |
impl Method for BeginFrame { | |
const NAME: &'static str = "HeadlessExperimental.beginFrame"; | |
type ReturnObject = BeginFrameReturnObject; | |
} | |
/// Method parameters of the `HeadlessExperimental::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `HeadlessExperimental::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `HeadlessExperimental::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `HeadlessExperimental::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "HeadlessExperimental.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `HeadlessExperimental::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `HeadlessExperimental::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `HeadlessExperimental::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `HeadlessExperimental::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "HeadlessExperimental.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Issued when the target starts or stops needing BeginFrames. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NeedsBeginFramesChangedEvent { | |
/// True if BeginFrames are needed, false otherwise. | |
pub needs_begin_frames: Boolean, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Issued when the target starts or stops needing BeginFrames. | |
#[serde(rename = "HeadlessExperimental.needsBeginFramesChanged")] | |
NeedsBeginFramesChanged(NeedsBeginFramesChangedEvent), | |
} | |
} | |
/// Input/Output operations for streams produced by DevTools. | |
#[cfg(any(feature = "all", feature = "io"))] | |
pub trait IO { | |
type Error; | |
/// Close the stream, discard any temporary backing storage. | |
fn close(&mut self, handle: io::StreamHandle) -> Result<(), <Self as IO>::Error>; | |
/// Read a chunk of the stream | |
fn read(&mut self, handle: io::StreamHandle, offset: Option<Integer>, size: Option<Integer>) -> Result<(Option<Boolean>, String, Boolean), <Self as IO>::Error>; | |
/// Return UUID of Blob object specified by a remote object id. | |
fn resolve_blob(&mut self, object_id: runtime::RemoteObjectId) -> Result<(String), <Self as IO>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "io"))] | |
impl<T> IO for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn close(&mut self, handle: io::StreamHandle) -> Result<(), <Self as IO>::Error> { | |
CallSite::call(self, io::CloseRequest { handle }).map(|_| ()) | |
} | |
fn read(&mut self, handle: io::StreamHandle, offset: Option<Integer>, size: Option<Integer>) -> Result<(Option<Boolean>, String, Boolean), <Self as IO>::Error> { | |
CallSite::call(self, io::ReadRequest { handle, offset, size }).map(|res| (res.base64_encoded, res.data, res.eof)) | |
} | |
fn resolve_blob(&mut self, object_id: runtime::RemoteObjectId) -> Result<(String), <Self as IO>::Error> { | |
CallSite::call(self, io::ResolveBlobRequest { object_id }).map(|res| (res.uuid)) | |
} | |
} | |
/// Input/Output operations for streams produced by DevTools. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "io")))] | |
pub trait AsyncIO where Self: Sized { | |
type Error; | |
type Close: futures::Future<Item = ((), Self), Error = <Self as AsyncIO>::Error>; | |
type Read: futures::Future<Item = ((Option<Boolean>, String, Boolean), Self), Error = <Self as AsyncIO>::Error>; | |
type ResolveBlob: futures::Future<Item = ((String), Self), Error = <Self as AsyncIO>::Error>; | |
/// Close the stream, discard any temporary backing storage. | |
fn close(self, handle: io::StreamHandle) -> <Self as AsyncIO>::Close; | |
/// Read a chunk of the stream | |
fn read(self, handle: io::StreamHandle, offset: Option<Integer>, size: Option<Integer>) -> <Self as AsyncIO>::Read; | |
/// Return UUID of Blob object specified by a remote object id. | |
fn resolve_blob(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncIO>::ResolveBlob; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "io")))] | |
impl<T> AsyncIO for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Close = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Read = Box<dyn futures::Future<Item = ((Option<Boolean>, String, Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ResolveBlob = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn close(self, handle: io::StreamHandle) -> <Self as AsyncIO>::Close { | |
Box::new(AsyncCallSite::async_call(self, io::CloseRequest { handle }).map(|(_, self_)| ((), self_))) | |
} | |
fn read(self, handle: io::StreamHandle, offset: Option<Integer>, size: Option<Integer>) -> <Self as AsyncIO>::Read { | |
Box::new(AsyncCallSite::async_call(self, io::ReadRequest { handle, offset, size }).map(|(res, self_)| ((res.base64_encoded, res.data, res.eof), self_))) | |
} | |
fn resolve_blob(self, object_id: runtime::RemoteObjectId) -> <Self as AsyncIO>::ResolveBlob { | |
Box::new(AsyncCallSite::async_call(self, io::ResolveBlobRequest { object_id }).map(|(res, self_)| ((res.uuid), self_))) | |
} | |
} | |
/// Input/Output operations for streams produced by DevTools. | |
#[cfg(any(feature = "all", feature = "io"))] | |
#[allow(deprecated)] | |
pub mod io { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// This is either obtained from another method or specifed as `blob:<uuid>` where | |
/// `<uuid>` is an UUID of a Blob. | |
pub type StreamHandle = String; | |
/// Method parameters of the `IO::close` command. | |
pub type Close = CloseRequest; | |
/// Return object of the `IO::close` command. | |
pub type CloseReturnObject = CloseResponse; | |
/// Request object of the `IO::close` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CloseRequest { | |
/// Handle of the stream to close. | |
pub handle: StreamHandle, | |
} | |
/// Response object of the `IO::close` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CloseResponse { | |
} | |
impl Method for Close { | |
const NAME: &'static str = "IO.close"; | |
type ReturnObject = CloseReturnObject; | |
} | |
/// Method parameters of the `IO::read` command. | |
pub type Read = ReadRequest; | |
/// Return object of the `IO::read` command. | |
pub type ReadReturnObject = ReadResponse; | |
/// Request object of the `IO::read` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReadRequest { | |
/// Handle of the stream to read. | |
pub handle: StreamHandle, | |
/// Seek to the specified offset before reading (if not specificed, proceed with offset | |
/// following the last read). Some types of streams may only support sequential reads. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub offset: Option<Integer>, | |
/// Maximum number of bytes to read (left upon the agent discretion if not specified). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub size: Option<Integer>, | |
} | |
/// Response object of the `IO::read` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReadResponse { | |
/// Set if the data is base64-encoded | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub base64_encoded: Option<Boolean>, | |
/// Data that were read. | |
pub data: String, | |
/// Set if the end-of-file condition occured while reading. | |
pub eof: Boolean, | |
} | |
impl Method for Read { | |
const NAME: &'static str = "IO.read"; | |
type ReturnObject = ReadReturnObject; | |
} | |
/// Method parameters of the `IO::resolveBlob` command. | |
pub type ResolveBlob = ResolveBlobRequest; | |
/// Return object of the `IO::resolveBlob` command. | |
pub type ResolveBlobReturnObject = ResolveBlobResponse; | |
/// Request object of the `IO::resolveBlob` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveBlobRequest { | |
/// Object id of a Blob object wrapper. | |
pub object_id: runtime::RemoteObjectId, | |
} | |
/// Response object of the `IO::resolveBlob` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResolveBlobResponse { | |
/// UUID of the specified Blob. | |
pub uuid: String, | |
} | |
impl Method for ResolveBlob { | |
const NAME: &'static str = "IO.resolveBlob"; | |
type ReturnObject = ResolveBlobReturnObject; | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "indexed_db"))] | |
pub trait IndexedDB: Runtime { | |
type Error; | |
/// Clears all entries from an object store. | |
fn clear_object_store(&mut self, security_origin: String, database_name: String, object_store_name: String) -> Result<(), <Self as IndexedDB>::Error>; | |
/// Deletes a database. | |
fn delete_database(&mut self, security_origin: String, database_name: String) -> Result<(), <Self as IndexedDB>::Error>; | |
/// Delete a range of entries from an object store | |
fn delete_object_store_entries(&mut self, security_origin: String, database_name: String, object_store_name: String, key_range: indexed_db::KeyRange) -> Result<(), <Self as IndexedDB>::Error>; | |
/// Disables events from backend. | |
fn disable(&mut self) -> Result<(), <Self as IndexedDB>::Error>; | |
/// Enables events from backend. | |
fn enable(&mut self) -> Result<(), <Self as IndexedDB>::Error>; | |
/// Requests data from object store or index. | |
fn request_data(&mut self, security_origin: String, database_name: String, object_store_name: String, index_name: String, skip_count: Integer, page_size: Integer, key_range: Option<indexed_db::KeyRange>) -> Result<(Vec<indexed_db::DataEntry>, Boolean), <Self as IndexedDB>::Error>; | |
/// Gets metadata of an object store | |
fn get_metadata(&mut self, security_origin: String, database_name: String, object_store_name: String) -> Result<(Number, Number), <Self as IndexedDB>::Error>; | |
/// Requests database with given name in given frame. | |
fn request_database(&mut self, security_origin: String, database_name: String) -> Result<(indexed_db::DatabaseWithObjectStores), <Self as IndexedDB>::Error>; | |
/// Requests database names for given security origin. | |
fn request_database_names(&mut self, security_origin: String) -> Result<(Vec<String>), <Self as IndexedDB>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "indexed_db"))] | |
impl<T> IndexedDB for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn clear_object_store(&mut self, security_origin: String, database_name: String, object_store_name: String) -> Result<(), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::ClearObjectStoreRequest { security_origin, database_name, object_store_name }).map(|_| ()) | |
} | |
fn delete_database(&mut self, security_origin: String, database_name: String) -> Result<(), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::DeleteDatabaseRequest { security_origin, database_name }).map(|_| ()) | |
} | |
fn delete_object_store_entries(&mut self, security_origin: String, database_name: String, object_store_name: String, key_range: indexed_db::KeyRange) -> Result<(), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::DeleteObjectStoreEntriesRequest { security_origin, database_name, object_store_name, key_range }).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::EnableRequest {}).map(|_| ()) | |
} | |
fn request_data(&mut self, security_origin: String, database_name: String, object_store_name: String, index_name: String, skip_count: Integer, page_size: Integer, key_range: Option<indexed_db::KeyRange>) -> Result<(Vec<indexed_db::DataEntry>, Boolean), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::RequestDataRequest { security_origin, database_name, object_store_name, index_name, skip_count, page_size, key_range }).map(|res| (res.object_store_data_entries, res.has_more)) | |
} | |
fn get_metadata(&mut self, security_origin: String, database_name: String, object_store_name: String) -> Result<(Number, Number), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::GetMetadataRequest { security_origin, database_name, object_store_name }).map(|res| (res.entries_count, res.key_generator_value)) | |
} | |
fn request_database(&mut self, security_origin: String, database_name: String) -> Result<(indexed_db::DatabaseWithObjectStores), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::RequestDatabaseRequest { security_origin, database_name }).map(|res| (res.database_with_object_stores)) | |
} | |
fn request_database_names(&mut self, security_origin: String) -> Result<(Vec<String>), <Self as IndexedDB>::Error> { | |
CallSite::call(self, indexed_db::RequestDatabaseNamesRequest { security_origin }).map(|res| (res.database_names)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "indexed_db")))] | |
pub trait AsyncIndexedDB: AsyncRuntime where Self: Sized { | |
type Error; | |
type ClearObjectStore: futures::Future<Item = ((), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type DeleteDatabase: futures::Future<Item = ((), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type DeleteObjectStoreEntries: futures::Future<Item = ((), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type RequestData: futures::Future<Item = ((Vec<indexed_db::DataEntry>, Boolean), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type GetMetadata: futures::Future<Item = ((Number, Number), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type RequestDatabase: futures::Future<Item = ((indexed_db::DatabaseWithObjectStores), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
type RequestDatabaseNames: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncIndexedDB>::Error>; | |
/// Clears all entries from an object store. | |
fn clear_object_store(self, security_origin: String, database_name: String, object_store_name: String) -> <Self as AsyncIndexedDB>::ClearObjectStore; | |
/// Deletes a database. | |
fn delete_database(self, security_origin: String, database_name: String) -> <Self as AsyncIndexedDB>::DeleteDatabase; | |
/// Delete a range of entries from an object store | |
fn delete_object_store_entries(self, security_origin: String, database_name: String, object_store_name: String, key_range: indexed_db::KeyRange) -> <Self as AsyncIndexedDB>::DeleteObjectStoreEntries; | |
/// Disables events from backend. | |
fn disable(self) -> <Self as AsyncIndexedDB>::Disable; | |
/// Enables events from backend. | |
fn enable(self) -> <Self as AsyncIndexedDB>::Enable; | |
/// Requests data from object store or index. | |
fn request_data(self, security_origin: String, database_name: String, object_store_name: String, index_name: String, skip_count: Integer, page_size: Integer, key_range: Option<indexed_db::KeyRange>) -> <Self as AsyncIndexedDB>::RequestData; | |
/// Gets metadata of an object store | |
fn get_metadata(self, security_origin: String, database_name: String, object_store_name: String) -> <Self as AsyncIndexedDB>::GetMetadata; | |
/// Requests database with given name in given frame. | |
fn request_database(self, security_origin: String, database_name: String) -> <Self as AsyncIndexedDB>::RequestDatabase; | |
/// Requests database names for given security origin. | |
fn request_database_names(self, security_origin: String) -> <Self as AsyncIndexedDB>::RequestDatabaseNames; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "indexed_db")))] | |
impl<T> AsyncIndexedDB for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type ClearObjectStore = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DeleteDatabase = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DeleteObjectStoreEntries = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestData = Box<dyn futures::Future<Item = ((Vec<indexed_db::DataEntry>, Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetMetadata = Box<dyn futures::Future<Item = ((Number, Number), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestDatabase = Box<dyn futures::Future<Item = ((indexed_db::DatabaseWithObjectStores), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RequestDatabaseNames = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn clear_object_store(self, security_origin: String, database_name: String, object_store_name: String) -> <Self as AsyncIndexedDB>::ClearObjectStore { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::ClearObjectStoreRequest { security_origin, database_name, object_store_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn delete_database(self, security_origin: String, database_name: String) -> <Self as AsyncIndexedDB>::DeleteDatabase { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::DeleteDatabaseRequest { security_origin, database_name }).map(|(_, self_)| ((), self_))) | |
} | |
fn delete_object_store_entries(self, security_origin: String, database_name: String, object_store_name: String, key_range: indexed_db::KeyRange) -> <Self as AsyncIndexedDB>::DeleteObjectStoreEntries { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::DeleteObjectStoreEntriesRequest { security_origin, database_name, object_store_name, key_range }).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncIndexedDB>::Disable { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncIndexedDB>::Enable { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn request_data(self, security_origin: String, database_name: String, object_store_name: String, index_name: String, skip_count: Integer, page_size: Integer, key_range: Option<indexed_db::KeyRange>) -> <Self as AsyncIndexedDB>::RequestData { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::RequestDataRequest { security_origin, database_name, object_store_name, index_name, skip_count, page_size, key_range }).map(|(res, self_)| ((res.object_store_data_entries, res.has_more), self_))) | |
} | |
fn get_metadata(self, security_origin: String, database_name: String, object_store_name: String) -> <Self as AsyncIndexedDB>::GetMetadata { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::GetMetadataRequest { security_origin, database_name, object_store_name }).map(|(res, self_)| ((res.entries_count, res.key_generator_value), self_))) | |
} | |
fn request_database(self, security_origin: String, database_name: String) -> <Self as AsyncIndexedDB>::RequestDatabase { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::RequestDatabaseRequest { security_origin, database_name }).map(|(res, self_)| ((res.database_with_object_stores), self_))) | |
} | |
fn request_database_names(self, security_origin: String) -> <Self as AsyncIndexedDB>::RequestDatabaseNames { | |
Box::new(AsyncCallSite::async_call(self, indexed_db::RequestDatabaseNamesRequest { security_origin }).map(|(res, self_)| ((res.database_names), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "indexed_db"))] | |
#[allow(deprecated)] | |
pub mod indexed_db { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Database with an array of object stores. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DatabaseWithObjectStores { | |
/// Database name. | |
pub name: String, | |
/// Database version (type is not 'integer', as the standard | |
/// requires the version number to be 'unsigned long long') | |
pub version: Number, | |
/// Object stores in this database. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub object_stores: Vec<ObjectStore>, | |
} | |
/// Object store. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ObjectStore { | |
/// Object store name. | |
pub name: String, | |
/// Object store key path. | |
pub key_path: KeyPath, | |
/// If true, object store has auto increment flag set. | |
pub auto_increment: Boolean, | |
/// Indexes in this object store. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub indexes: Vec<ObjectStoreIndex>, | |
} | |
/// Object store index. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ObjectStoreIndex { | |
/// Index name. | |
pub name: String, | |
/// Index key path. | |
pub key_path: KeyPath, | |
/// If true, index is unique. | |
pub unique: Boolean, | |
/// If true, index allows multiple entries for a key. | |
pub multi_entry: Boolean, | |
} | |
/// Key. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Key { | |
/// Key type. | |
#[serde(rename = "type")] | |
pub r#type: KeyType, | |
/// Number value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub number: Option<Number>, | |
/// String value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub string: Option<String>, | |
/// Date value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub date: Option<Number>, | |
/// Array value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub array: Option<Vec<Key>>, | |
} | |
/// Allow values for the `Key::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum KeyType { | |
Number, | |
String, | |
Date, | |
Array, | |
} | |
/// Key range. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct KeyRange { | |
/// Lower bound. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub lower: Option<Key>, | |
/// Upper bound. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub upper: Option<Key>, | |
/// If true lower bound is open. | |
pub lower_open: Boolean, | |
/// If true upper bound is open. | |
pub upper_open: Boolean, | |
} | |
/// Data entry. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DataEntry { | |
/// Key object. | |
pub key: runtime::RemoteObject, | |
/// Primary key object. | |
pub primary_key: runtime::RemoteObject, | |
/// Value object. | |
pub value: runtime::RemoteObject, | |
} | |
/// Key path. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct KeyPath { | |
/// Key path type. | |
#[serde(rename = "type")] | |
pub r#type: KeyPathType, | |
/// String value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub string: Option<String>, | |
/// Array value. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub array: Option<Vec<String>>, | |
} | |
/// Allow values for the `KeyPath::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum KeyPathType { | |
Null, | |
String, | |
Array, | |
} | |
/// Method parameters of the `IndexedDB::clearObjectStore` command. | |
pub type ClearObjectStore = ClearObjectStoreRequest; | |
/// Return object of the `IndexedDB::clearObjectStore` command. | |
pub type ClearObjectStoreReturnObject = ClearObjectStoreResponse; | |
/// Request object of the `IndexedDB::clearObjectStore` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearObjectStoreRequest { | |
/// Security origin. | |
pub security_origin: String, | |
/// Database name. | |
pub database_name: String, | |
/// Object store name. | |
pub object_store_name: String, | |
} | |
/// Response object of the `IndexedDB::clearObjectStore` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearObjectStoreResponse { | |
} | |
impl Method for ClearObjectStore { | |
const NAME: &'static str = "IndexedDB.clearObjectStore"; | |
type ReturnObject = ClearObjectStoreReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::deleteDatabase` command. | |
pub type DeleteDatabase = DeleteDatabaseRequest; | |
/// Return object of the `IndexedDB::deleteDatabase` command. | |
pub type DeleteDatabaseReturnObject = DeleteDatabaseResponse; | |
/// Request object of the `IndexedDB::deleteDatabase` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteDatabaseRequest { | |
/// Security origin. | |
pub security_origin: String, | |
/// Database name. | |
pub database_name: String, | |
} | |
/// Response object of the `IndexedDB::deleteDatabase` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteDatabaseResponse { | |
} | |
impl Method for DeleteDatabase { | |
const NAME: &'static str = "IndexedDB.deleteDatabase"; | |
type ReturnObject = DeleteDatabaseReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::deleteObjectStoreEntries` command. | |
pub type DeleteObjectStoreEntries = DeleteObjectStoreEntriesRequest; | |
/// Return object of the `IndexedDB::deleteObjectStoreEntries` command. | |
pub type DeleteObjectStoreEntriesReturnObject = DeleteObjectStoreEntriesResponse; | |
/// Request object of the `IndexedDB::deleteObjectStoreEntries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteObjectStoreEntriesRequest { | |
pub security_origin: String, | |
pub database_name: String, | |
pub object_store_name: String, | |
/// Range of entry keys to delete | |
pub key_range: KeyRange, | |
} | |
/// Response object of the `IndexedDB::deleteObjectStoreEntries` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteObjectStoreEntriesResponse { | |
} | |
impl Method for DeleteObjectStoreEntries { | |
const NAME: &'static str = "IndexedDB.deleteObjectStoreEntries"; | |
type ReturnObject = DeleteObjectStoreEntriesReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `IndexedDB::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `IndexedDB::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `IndexedDB::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "IndexedDB.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `IndexedDB::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `IndexedDB::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `IndexedDB::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "IndexedDB.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::requestData` command. | |
pub type RequestData = RequestDataRequest; | |
/// Return object of the `IndexedDB::requestData` command. | |
pub type RequestDataReturnObject = RequestDataResponse; | |
/// Request object of the `IndexedDB::requestData` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDataRequest { | |
/// Security origin. | |
pub security_origin: String, | |
/// Database name. | |
pub database_name: String, | |
/// Object store name. | |
pub object_store_name: String, | |
/// Index name, empty string for object store data requests. | |
pub index_name: String, | |
/// Number of records to skip. | |
pub skip_count: Integer, | |
/// Number of records to fetch. | |
pub page_size: Integer, | |
/// Key range. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub key_range: Option<KeyRange>, | |
} | |
/// Response object of the `IndexedDB::requestData` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDataResponse { | |
/// Array of object store data entries. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub object_store_data_entries: Vec<DataEntry>, | |
/// If true, there are more entries to fetch in the given range. | |
pub has_more: Boolean, | |
} | |
impl Method for RequestData { | |
const NAME: &'static str = "IndexedDB.requestData"; | |
type ReturnObject = RequestDataReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::getMetadata` command. | |
pub type GetMetadata = GetMetadataRequest; | |
/// Return object of the `IndexedDB::getMetadata` command. | |
pub type GetMetadataReturnObject = GetMetadataResponse; | |
/// Request object of the `IndexedDB::getMetadata` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMetadataRequest { | |
/// Security origin. | |
pub security_origin: String, | |
/// Database name. | |
pub database_name: String, | |
/// Object store name. | |
pub object_store_name: String, | |
} | |
/// Response object of the `IndexedDB::getMetadata` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetMetadataResponse { | |
/// the entries count | |
pub entries_count: Number, | |
/// the current value of key generator, to become the next inserted | |
/// key into the object store. Valid if objectStore.autoIncrement | |
/// is true. | |
pub key_generator_value: Number, | |
} | |
impl Method for GetMetadata { | |
const NAME: &'static str = "IndexedDB.getMetadata"; | |
type ReturnObject = GetMetadataReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::requestDatabase` command. | |
pub type RequestDatabase = RequestDatabaseRequest; | |
/// Return object of the `IndexedDB::requestDatabase` command. | |
pub type RequestDatabaseReturnObject = RequestDatabaseResponse; | |
/// Request object of the `IndexedDB::requestDatabase` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDatabaseRequest { | |
/// Security origin. | |
pub security_origin: String, | |
/// Database name. | |
pub database_name: String, | |
} | |
/// Response object of the `IndexedDB::requestDatabase` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDatabaseResponse { | |
/// Database with an array of object stores. | |
pub database_with_object_stores: DatabaseWithObjectStores, | |
} | |
impl Method for RequestDatabase { | |
const NAME: &'static str = "IndexedDB.requestDatabase"; | |
type ReturnObject = RequestDatabaseReturnObject; | |
} | |
/// Method parameters of the `IndexedDB::requestDatabaseNames` command. | |
pub type RequestDatabaseNames = RequestDatabaseNamesRequest; | |
/// Return object of the `IndexedDB::requestDatabaseNames` command. | |
pub type RequestDatabaseNamesReturnObject = RequestDatabaseNamesResponse; | |
/// Request object of the `IndexedDB::requestDatabaseNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDatabaseNamesRequest { | |
/// Security origin. | |
pub security_origin: String, | |
} | |
/// Response object of the `IndexedDB::requestDatabaseNames` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestDatabaseNamesResponse { | |
/// Database names for origin. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub database_names: Vec<String>, | |
} | |
impl Method for RequestDatabaseNames { | |
const NAME: &'static str = "IndexedDB.requestDatabaseNames"; | |
type ReturnObject = RequestDatabaseNamesReturnObject; | |
} | |
} | |
#[cfg(any(feature = "all", feature = "input"))] | |
pub trait Input { | |
type Error; | |
/// Dispatches a key event to the page. | |
fn dispatch_key_event(&mut self, req: input::DispatchKeyEventRequest) -> Result<(), <Self as Input>::Error>; | |
/// This method emulates inserting text that doesn't come from a key press, | |
/// for example an emoji keyboard or an IME. | |
#[cfg(feature = "experimental")] | |
fn insert_text(&mut self, text: String) -> Result<(), <Self as Input>::Error>; | |
/// Dispatches a mouse event to the page. | |
fn dispatch_mouse_event(&mut self, req: input::DispatchMouseEventRequest) -> Result<(), <Self as Input>::Error>; | |
/// Dispatches a touch event to the page. | |
fn dispatch_touch_event(&mut self, r#type: input::DispatchTouchEventRequestType, touch_points: Vec<input::TouchPoint>, modifiers: Option<Integer>, timestamp: Option<input::TimeSinceEpoch>) -> Result<(), <Self as Input>::Error>; | |
/// Emulates touch event from the mouse event parameters. | |
#[cfg(feature = "experimental")] | |
fn emulate_touch_from_mouse_event(&mut self, req: input::EmulateTouchFromMouseEventRequest) -> Result<(), <Self as Input>::Error>; | |
/// Ignores input events (useful while auditing page). | |
fn set_ignore_input_events(&mut self, ignore: Boolean) -> Result<(), <Self as Input>::Error>; | |
/// Synthesizes a pinch gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_pinch_gesture(&mut self, x: Number, y: Number, scale_factor: Number, relative_speed: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> Result<(), <Self as Input>::Error>; | |
/// Synthesizes a scroll gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_scroll_gesture(&mut self, req: input::SynthesizeScrollGestureRequest) -> Result<(), <Self as Input>::Error>; | |
/// Synthesizes a tap gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_tap_gesture(&mut self, x: Number, y: Number, duration: Option<Integer>, tap_count: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> Result<(), <Self as Input>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "input"))] | |
impl<T> Input for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn dispatch_key_event(&mut self, req: input::DispatchKeyEventRequest) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn insert_text(&mut self, text: String) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, input::InsertTextRequest { text }).map(|_| ()) | |
} | |
fn dispatch_mouse_event(&mut self, req: input::DispatchMouseEventRequest) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
fn dispatch_touch_event(&mut self, r#type: input::DispatchTouchEventRequestType, touch_points: Vec<input::TouchPoint>, modifiers: Option<Integer>, timestamp: Option<input::TimeSinceEpoch>) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, input::DispatchTouchEventRequest { r#type, touch_points, modifiers, timestamp }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn emulate_touch_from_mouse_event(&mut self, req: input::EmulateTouchFromMouseEventRequest) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
fn set_ignore_input_events(&mut self, ignore: Boolean) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, input::SetIgnoreInputEventsRequest { ignore }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_pinch_gesture(&mut self, x: Number, y: Number, scale_factor: Number, relative_speed: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, input::SynthesizePinchGestureRequest { x, y, scale_factor, relative_speed, gesture_source_type }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_scroll_gesture(&mut self, req: input::SynthesizeScrollGestureRequest) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_tap_gesture(&mut self, x: Number, y: Number, duration: Option<Integer>, tap_count: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> Result<(), <Self as Input>::Error> { | |
CallSite::call(self, input::SynthesizeTapGestureRequest { x, y, duration, tap_count, gesture_source_type }).map(|_| ()) | |
} | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "input")))] | |
pub trait AsyncInput where Self: Sized { | |
type Error; | |
type DispatchKeyEvent: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
#[cfg(feature = "experimental")] | |
type InsertText: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
type DispatchMouseEvent: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
type DispatchTouchEvent: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
#[cfg(feature = "experimental")] | |
type EmulateTouchFromMouseEvent: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
type SetIgnoreInputEvents: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
#[cfg(feature = "experimental")] | |
type SynthesizePinchGesture: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
#[cfg(feature = "experimental")] | |
type SynthesizeScrollGesture: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
#[cfg(feature = "experimental")] | |
type SynthesizeTapGesture: futures::Future<Item = ((), Self), Error = <Self as AsyncInput>::Error>; | |
/// Dispatches a key event to the page. | |
fn dispatch_key_event(self, req: input::DispatchKeyEventRequest) -> <Self as AsyncInput>::DispatchKeyEvent; | |
/// This method emulates inserting text that doesn't come from a key press, | |
/// for example an emoji keyboard or an IME. | |
#[cfg(feature = "experimental")] | |
fn insert_text(self, text: String) -> <Self as AsyncInput>::InsertText; | |
/// Dispatches a mouse event to the page. | |
fn dispatch_mouse_event(self, req: input::DispatchMouseEventRequest) -> <Self as AsyncInput>::DispatchMouseEvent; | |
/// Dispatches a touch event to the page. | |
fn dispatch_touch_event(self, r#type: input::DispatchTouchEventRequestType, touch_points: Vec<input::TouchPoint>, modifiers: Option<Integer>, timestamp: Option<input::TimeSinceEpoch>) -> <Self as AsyncInput>::DispatchTouchEvent; | |
/// Emulates touch event from the mouse event parameters. | |
#[cfg(feature = "experimental")] | |
fn emulate_touch_from_mouse_event(self, req: input::EmulateTouchFromMouseEventRequest) -> <Self as AsyncInput>::EmulateTouchFromMouseEvent; | |
/// Ignores input events (useful while auditing page). | |
fn set_ignore_input_events(self, ignore: Boolean) -> <Self as AsyncInput>::SetIgnoreInputEvents; | |
/// Synthesizes a pinch gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_pinch_gesture(self, x: Number, y: Number, scale_factor: Number, relative_speed: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> <Self as AsyncInput>::SynthesizePinchGesture; | |
/// Synthesizes a scroll gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_scroll_gesture(self, req: input::SynthesizeScrollGestureRequest) -> <Self as AsyncInput>::SynthesizeScrollGesture; | |
/// Synthesizes a tap gesture over a time period by issuing appropriate touch events. | |
#[cfg(feature = "experimental")] | |
fn synthesize_tap_gesture(self, x: Number, y: Number, duration: Option<Integer>, tap_count: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> <Self as AsyncInput>::SynthesizeTapGesture; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "input")))] | |
impl<T> AsyncInput for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type DispatchKeyEvent = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type InsertText = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DispatchMouseEvent = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DispatchTouchEvent = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type EmulateTouchFromMouseEvent = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetIgnoreInputEvents = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SynthesizePinchGesture = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SynthesizeScrollGesture = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SynthesizeTapGesture = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn dispatch_key_event(self, req: input::DispatchKeyEventRequest) -> <Self as AsyncInput>::DispatchKeyEvent { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn insert_text(self, text: String) -> <Self as AsyncInput>::InsertText { | |
Box::new(AsyncCallSite::async_call(self, input::InsertTextRequest { text }).map(|(_, self_)| ((), self_))) | |
} | |
fn dispatch_mouse_event(self, req: input::DispatchMouseEventRequest) -> <Self as AsyncInput>::DispatchMouseEvent { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
fn dispatch_touch_event(self, r#type: input::DispatchTouchEventRequestType, touch_points: Vec<input::TouchPoint>, modifiers: Option<Integer>, timestamp: Option<input::TimeSinceEpoch>) -> <Self as AsyncInput>::DispatchTouchEvent { | |
Box::new(AsyncCallSite::async_call(self, input::DispatchTouchEventRequest { r#type, touch_points, modifiers, timestamp }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn emulate_touch_from_mouse_event(self, req: input::EmulateTouchFromMouseEventRequest) -> <Self as AsyncInput>::EmulateTouchFromMouseEvent { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
fn set_ignore_input_events(self, ignore: Boolean) -> <Self as AsyncInput>::SetIgnoreInputEvents { | |
Box::new(AsyncCallSite::async_call(self, input::SetIgnoreInputEventsRequest { ignore }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_pinch_gesture(self, x: Number, y: Number, scale_factor: Number, relative_speed: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> <Self as AsyncInput>::SynthesizePinchGesture { | |
Box::new(AsyncCallSite::async_call(self, input::SynthesizePinchGestureRequest { x, y, scale_factor, relative_speed, gesture_source_type }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_scroll_gesture(self, req: input::SynthesizeScrollGestureRequest) -> <Self as AsyncInput>::SynthesizeScrollGesture { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn synthesize_tap_gesture(self, x: Number, y: Number, duration: Option<Integer>, tap_count: Option<Integer>, gesture_source_type: Option<input::GestureSourceType>) -> <Self as AsyncInput>::SynthesizeTapGesture { | |
Box::new(AsyncCallSite::async_call(self, input::SynthesizeTapGestureRequest { x, y, duration, tap_count, gesture_source_type }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
#[cfg(any(feature = "all", feature = "input"))] | |
#[allow(deprecated)] | |
pub mod input { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TouchPoint { | |
/// X coordinate of the event relative to the main frame's viewport in CSS pixels. | |
pub x: Number, | |
/// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to | |
/// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. | |
pub y: Number, | |
/// X radius of the touch area (default: 1.0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub radius_x: Option<Number>, | |
/// Y radius of the touch area (default: 1.0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub radius_y: Option<Number>, | |
/// Rotation angle (default: 0.0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub rotation_angle: Option<Number>, | |
/// Force (default: 1.0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub force: Option<Number>, | |
/// Identifier used to track touch sources between events, must be unique within an event. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub id: Option<Number>, | |
} | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum GestureSourceType { | |
Default, | |
Touch, | |
Mouse, | |
} | |
/// UTC time in seconds, counted from January 1, 1970. | |
pub type TimeSinceEpoch = Number; | |
/// Method parameters of the `Input::dispatchKeyEvent` command. | |
pub type DispatchKeyEvent = DispatchKeyEventRequest; | |
/// Return object of the `Input::dispatchKeyEvent` command. | |
pub type DispatchKeyEventReturnObject = DispatchKeyEventResponse; | |
/// Request object of the `Input::dispatchKeyEvent` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchKeyEventRequest { | |
/// Type of the key event. | |
#[serde(rename = "type")] | |
pub r#type: DispatchKeyEventRequestType, | |
/// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 | |
/// (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub modifiers: Option<Integer>, | |
/// Time at which the event occurred. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timestamp: Option<TimeSinceEpoch>, | |
/// Text as generated by processing a virtual key code with a keyboard layout. Not needed for | |
/// for `keyUp` and `rawKeyDown` events (default: "") | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub text: Option<String>, | |
/// Text that would have been generated by the keyboard if no modifiers were pressed (except for | |
/// shift). Useful for shortcut (accelerator) key handling (default: ""). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub unmodified_text: Option<String>, | |
/// Unique key identifier (e.g., 'U+0041') (default: ""). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub key_identifier: Option<String>, | |
/// Unique DOM defined string value for each physical key (e.g., 'KeyA') (default: ""). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub code: Option<String>, | |
/// Unique DOM defined string value describing the meaning of the key in the context of active | |
/// modifiers, keyboard layout, etc (e.g., 'AltGr') (default: ""). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub key: Option<String>, | |
/// Windows virtual key code (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub windows_virtual_key_code: Option<Integer>, | |
/// Native virtual key code (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub native_virtual_key_code: Option<Integer>, | |
/// Whether the event was generated from auto repeat (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub auto_repeat: Option<Boolean>, | |
/// Whether the event was generated from the keypad (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_keypad: Option<Boolean>, | |
/// Whether the event was a system key event (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_system_key: Option<Boolean>, | |
/// Whether the event was from the left or right side of the keyboard. 1=Left, 2=Right (default: | |
/// 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub location: Option<Integer>, | |
} | |
/// Allow values for the `DispatchKeyEventRequest::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DispatchKeyEventRequestType { | |
KeyDown, | |
KeyUp, | |
RawKeyDown, | |
Char, | |
} | |
/// Response object of the `Input::dispatchKeyEvent` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchKeyEventResponse { | |
} | |
impl Method for DispatchKeyEvent { | |
const NAME: &'static str = "Input.dispatchKeyEvent"; | |
type ReturnObject = DispatchKeyEventReturnObject; | |
} | |
/// Method parameters of the `Input::insertText` command. | |
#[cfg(feature = "experimental")] | |
pub type InsertText = InsertTextRequest; | |
/// Return object of the `Input::insertText` command. | |
#[cfg(feature = "experimental")] | |
pub type InsertTextReturnObject = InsertTextResponse; | |
/// Request object of the `Input::insertText` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InsertTextRequest { | |
/// The text to insert. | |
pub text: String, | |
} | |
/// Response object of the `Input::insertText` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InsertTextResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for InsertText { | |
const NAME: &'static str = "Input.insertText"; | |
type ReturnObject = InsertTextReturnObject; | |
} | |
/// Method parameters of the `Input::dispatchMouseEvent` command. | |
pub type DispatchMouseEvent = DispatchMouseEventRequest; | |
/// Return object of the `Input::dispatchMouseEvent` command. | |
pub type DispatchMouseEventReturnObject = DispatchMouseEventResponse; | |
/// Request object of the `Input::dispatchMouseEvent` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchMouseEventRequest { | |
/// Type of the mouse event. | |
#[serde(rename = "type")] | |
pub r#type: DispatchMouseEventRequestType, | |
/// X coordinate of the event relative to the main frame's viewport in CSS pixels. | |
pub x: Number, | |
/// Y coordinate of the event relative to the main frame's viewport in CSS pixels. 0 refers to | |
/// the top of the viewport and Y increases as it proceeds towards the bottom of the viewport. | |
pub y: Number, | |
/// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 | |
/// (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub modifiers: Option<Integer>, | |
/// Time at which the event occurred. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timestamp: Option<TimeSinceEpoch>, | |
/// Mouse button (default: "none"). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub button: Option<DispatchMouseEventRequestButton>, | |
/// A number indicating which buttons are pressed on the mouse when a mouse event is triggered. | |
/// Left=1, Right=2, Middle=4, Back=8, Forward=16, None=0. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub buttons: Option<Integer>, | |
/// Number of times the mouse button was clicked (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub click_count: Option<Integer>, | |
/// X delta in CSS pixels for mouse wheel event (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta_x: Option<Number>, | |
/// Y delta in CSS pixels for mouse wheel event (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta_y: Option<Number>, | |
/// Pointer type (default: "mouse"). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pointer_type: Option<DispatchMouseEventRequestPointerType>, | |
} | |
/// Allow values for the `DispatchMouseEventRequest::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DispatchMouseEventRequestType { | |
MousePressed, | |
MouseReleased, | |
MouseMoved, | |
MouseWheel, | |
} | |
/// Allow values for the `DispatchMouseEventRequest::button` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DispatchMouseEventRequestButton { | |
None, | |
Left, | |
Middle, | |
Right, | |
Back, | |
Forward, | |
} | |
/// Allow values for the `DispatchMouseEventRequest::pointerType` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DispatchMouseEventRequestPointerType { | |
Mouse, | |
Pen, | |
} | |
/// Response object of the `Input::dispatchMouseEvent` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchMouseEventResponse { | |
} | |
impl Method for DispatchMouseEvent { | |
const NAME: &'static str = "Input.dispatchMouseEvent"; | |
type ReturnObject = DispatchMouseEventReturnObject; | |
} | |
/// Method parameters of the `Input::dispatchTouchEvent` command. | |
pub type DispatchTouchEvent = DispatchTouchEventRequest; | |
/// Return object of the `Input::dispatchTouchEvent` command. | |
pub type DispatchTouchEventReturnObject = DispatchTouchEventResponse; | |
/// Request object of the `Input::dispatchTouchEvent` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchTouchEventRequest { | |
/// Type of the touch event. TouchEnd and TouchCancel must not contain any touch points, while | |
/// TouchStart and TouchMove must contains at least one. | |
#[serde(rename = "type")] | |
pub r#type: DispatchTouchEventRequestType, | |
/// Active touch points on the touch device. One event per any changed point (compared to | |
/// previous touch event in a sequence) is generated, emulating pressing/moving/releasing points | |
/// one by one. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub touch_points: Vec<TouchPoint>, | |
/// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 | |
/// (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub modifiers: Option<Integer>, | |
/// Time at which the event occurred. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timestamp: Option<TimeSinceEpoch>, | |
} | |
/// Allow values for the `DispatchTouchEventRequest::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DispatchTouchEventRequestType { | |
TouchStart, | |
TouchEnd, | |
TouchMove, | |
TouchCancel, | |
} | |
/// Response object of the `Input::dispatchTouchEvent` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DispatchTouchEventResponse { | |
} | |
impl Method for DispatchTouchEvent { | |
const NAME: &'static str = "Input.dispatchTouchEvent"; | |
type ReturnObject = DispatchTouchEventReturnObject; | |
} | |
/// Method parameters of the `Input::emulateTouchFromMouseEvent` command. | |
#[cfg(feature = "experimental")] | |
pub type EmulateTouchFromMouseEvent = EmulateTouchFromMouseEventRequest; | |
/// Return object of the `Input::emulateTouchFromMouseEvent` command. | |
#[cfg(feature = "experimental")] | |
pub type EmulateTouchFromMouseEventReturnObject = EmulateTouchFromMouseEventResponse; | |
/// Request object of the `Input::emulateTouchFromMouseEvent` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EmulateTouchFromMouseEventRequest { | |
/// Type of the mouse event. | |
#[serde(rename = "type")] | |
pub r#type: EmulateTouchFromMouseEventRequestType, | |
/// X coordinate of the mouse pointer in DIP. | |
pub x: Integer, | |
/// Y coordinate of the mouse pointer in DIP. | |
pub y: Integer, | |
/// Mouse button. | |
pub button: EmulateTouchFromMouseEventRequestButton, | |
/// Time at which the event occurred (default: current time). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timestamp: Option<TimeSinceEpoch>, | |
/// X delta in DIP for mouse wheel event (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta_x: Option<Number>, | |
/// Y delta in DIP for mouse wheel event (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub delta_y: Option<Number>, | |
/// Bit field representing pressed modifier keys. Alt=1, Ctrl=2, Meta/Command=4, Shift=8 | |
/// (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub modifiers: Option<Integer>, | |
/// Number of times the mouse button was clicked (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub click_count: Option<Integer>, | |
} | |
/// Allow values for the `EmulateTouchFromMouseEventRequest::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum EmulateTouchFromMouseEventRequestType { | |
MousePressed, | |
MouseReleased, | |
MouseMoved, | |
MouseWheel, | |
} | |
/// Allow values for the `EmulateTouchFromMouseEventRequest::button` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum EmulateTouchFromMouseEventRequestButton { | |
None, | |
Left, | |
Middle, | |
Right, | |
} | |
/// Response object of the `Input::emulateTouchFromMouseEvent` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EmulateTouchFromMouseEventResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for EmulateTouchFromMouseEvent { | |
const NAME: &'static str = "Input.emulateTouchFromMouseEvent"; | |
type ReturnObject = EmulateTouchFromMouseEventReturnObject; | |
} | |
/// Method parameters of the `Input::setIgnoreInputEvents` command. | |
pub type SetIgnoreInputEvents = SetIgnoreInputEventsRequest; | |
/// Return object of the `Input::setIgnoreInputEvents` command. | |
pub type SetIgnoreInputEventsReturnObject = SetIgnoreInputEventsResponse; | |
/// Request object of the `Input::setIgnoreInputEvents` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetIgnoreInputEventsRequest { | |
/// Ignores input events processing when set to true. | |
pub ignore: Boolean, | |
} | |
/// Response object of the `Input::setIgnoreInputEvents` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetIgnoreInputEventsResponse { | |
} | |
impl Method for SetIgnoreInputEvents { | |
const NAME: &'static str = "Input.setIgnoreInputEvents"; | |
type ReturnObject = SetIgnoreInputEventsReturnObject; | |
} | |
/// Method parameters of the `Input::synthesizePinchGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizePinchGesture = SynthesizePinchGestureRequest; | |
/// Return object of the `Input::synthesizePinchGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizePinchGestureReturnObject = SynthesizePinchGestureResponse; | |
/// Request object of the `Input::synthesizePinchGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizePinchGestureRequest { | |
/// X coordinate of the start of the gesture in CSS pixels. | |
pub x: Number, | |
/// Y coordinate of the start of the gesture in CSS pixels. | |
pub y: Number, | |
/// Relative scale factor after zooming (>1.0 zooms in, <1.0 zooms out). | |
pub scale_factor: Number, | |
/// Relative pointer speed in pixels per second (default: 800). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub relative_speed: Option<Integer>, | |
/// Which type of input events to be generated (default: 'default', which queries the platform | |
/// for the preferred input type). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub gesture_source_type: Option<GestureSourceType>, | |
} | |
/// Response object of the `Input::synthesizePinchGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizePinchGestureResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SynthesizePinchGesture { | |
const NAME: &'static str = "Input.synthesizePinchGesture"; | |
type ReturnObject = SynthesizePinchGestureReturnObject; | |
} | |
/// Method parameters of the `Input::synthesizeScrollGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizeScrollGesture = SynthesizeScrollGestureRequest; | |
/// Return object of the `Input::synthesizeScrollGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizeScrollGestureReturnObject = SynthesizeScrollGestureResponse; | |
/// Request object of the `Input::synthesizeScrollGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizeScrollGestureRequest { | |
/// X coordinate of the start of the gesture in CSS pixels. | |
pub x: Number, | |
/// Y coordinate of the start of the gesture in CSS pixels. | |
pub y: Number, | |
/// The distance to scroll along the X axis (positive to scroll left). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub x_distance: Option<Number>, | |
/// The distance to scroll along the Y axis (positive to scroll up). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub y_distance: Option<Number>, | |
/// The number of additional pixels to scroll back along the X axis, in addition to the given | |
/// distance. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub x_overscroll: Option<Number>, | |
/// The number of additional pixels to scroll back along the Y axis, in addition to the given | |
/// distance. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub y_overscroll: Option<Number>, | |
/// Prevent fling (default: true). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub prevent_fling: Option<Boolean>, | |
/// Swipe speed in pixels per second (default: 800). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub speed: Option<Integer>, | |
/// Which type of input events to be generated (default: 'default', which queries the platform | |
/// for the preferred input type). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub gesture_source_type: Option<GestureSourceType>, | |
/// The number of times to repeat the gesture (default: 0). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub repeat_count: Option<Integer>, | |
/// The number of milliseconds delay between each repeat. (default: 250). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub repeat_delay_ms: Option<Integer>, | |
/// The name of the interaction markers to generate, if not empty (default: ""). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub interaction_marker_name: Option<String>, | |
} | |
/// Response object of the `Input::synthesizeScrollGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizeScrollGestureResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SynthesizeScrollGesture { | |
const NAME: &'static str = "Input.synthesizeScrollGesture"; | |
type ReturnObject = SynthesizeScrollGestureReturnObject; | |
} | |
/// Method parameters of the `Input::synthesizeTapGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizeTapGesture = SynthesizeTapGestureRequest; | |
/// Return object of the `Input::synthesizeTapGesture` command. | |
#[cfg(feature = "experimental")] | |
pub type SynthesizeTapGestureReturnObject = SynthesizeTapGestureResponse; | |
/// Request object of the `Input::synthesizeTapGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizeTapGestureRequest { | |
/// X coordinate of the start of the gesture in CSS pixels. | |
pub x: Number, | |
/// Y coordinate of the start of the gesture in CSS pixels. | |
pub y: Number, | |
/// Duration between touchdown and touchup events in ms (default: 50). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub duration: Option<Integer>, | |
/// Number of times to perform the tap (e.g. 2 for double tap, default: 1). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub tap_count: Option<Integer>, | |
/// Which type of input events to be generated (default: 'default', which queries the platform | |
/// for the preferred input type). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub gesture_source_type: Option<GestureSourceType>, | |
} | |
/// Response object of the `Input::synthesizeTapGesture` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SynthesizeTapGestureResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SynthesizeTapGesture { | |
const NAME: &'static str = "Input.synthesizeTapGesture"; | |
type ReturnObject = SynthesizeTapGestureReturnObject; | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "inspector"))] | |
pub trait Inspector { | |
type Error; | |
/// Disables inspector domain notifications. | |
fn disable(&mut self) -> Result<(), <Self as Inspector>::Error>; | |
/// Enables inspector domain notifications. | |
fn enable(&mut self) -> Result<(), <Self as Inspector>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "inspector"))] | |
impl<T> Inspector for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as Inspector>::Error> { | |
CallSite::call(self, inspector::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Inspector>::Error> { | |
CallSite::call(self, inspector::EnableRequest {}).map(|_| ()) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "inspector")))] | |
pub trait AsyncInspector where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncInspector>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncInspector>::Error>; | |
/// Disables inspector domain notifications. | |
fn disable(self) -> <Self as AsyncInspector>::Disable; | |
/// Enables inspector domain notifications. | |
fn enable(self) -> <Self as AsyncInspector>::Enable; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "inspector")))] | |
impl<T> AsyncInspector for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncInspector>::Disable { | |
Box::new(AsyncCallSite::async_call(self, inspector::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncInspector>::Enable { | |
Box::new(AsyncCallSite::async_call(self, inspector::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "inspector"))] | |
#[allow(deprecated)] | |
pub mod inspector { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Method parameters of the `Inspector::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Inspector::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Inspector::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Inspector::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Inspector.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Inspector::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Inspector::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Inspector::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Inspector::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Inspector.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Fired when remote debugging connection is about to be terminated. Contains detach reason. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DetachedEvent { | |
/// The reason why connection has been terminated. | |
pub reason: String, | |
} | |
/// Fired when debugging target has crashed | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TargetCrashedEvent { | |
} | |
/// Fired when debugging target has reloaded after crash | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TargetReloadedAfterCrashEvent { | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Fired when remote debugging connection is about to be terminated. Contains detach reason. | |
#[serde(rename = "Inspector.detached")] | |
Detached(DetachedEvent), | |
/// Fired when debugging target has crashed | |
#[serde(rename = "Inspector.targetCrashed")] | |
TargetCrashed(TargetCrashedEvent), | |
/// Fired when debugging target has reloaded after crash | |
#[serde(rename = "Inspector.targetReloadedAfterCrash")] | |
TargetReloadedAfterCrash(TargetReloadedAfterCrashEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "layer_tree"))] | |
pub trait LayerTree: DOM { | |
type Error; | |
/// Provides the reasons why the given layer was composited. | |
fn compositing_reasons(&mut self, layer_id: layer_tree::LayerId) -> Result<(Vec<String>), <Self as LayerTree>::Error>; | |
/// Disables compositing tree inspection. | |
fn disable(&mut self) -> Result<(), <Self as LayerTree>::Error>; | |
/// Enables compositing tree inspection. | |
fn enable(&mut self) -> Result<(), <Self as LayerTree>::Error>; | |
/// Returns the snapshot identifier. | |
fn load_snapshot(&mut self, tiles: Vec<layer_tree::PictureTile>) -> Result<(layer_tree::SnapshotId), <Self as LayerTree>::Error>; | |
/// Returns the layer snapshot identifier. | |
fn make_snapshot(&mut self, layer_id: layer_tree::LayerId) -> Result<(layer_tree::SnapshotId), <Self as LayerTree>::Error>; | |
fn profile_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId, min_repeat_count: Option<Integer>, min_duration: Option<Number>, clip_rect: Option<dom::Rect>) -> Result<(Vec<layer_tree::PaintProfile>), <Self as LayerTree>::Error>; | |
/// Releases layer snapshot captured by the back-end. | |
fn release_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId) -> Result<(), <Self as LayerTree>::Error>; | |
/// Replays the layer snapshot and returns the resulting bitmap. | |
fn replay_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId, from_step: Option<Integer>, to_step: Option<Integer>, scale: Option<Number>) -> Result<(String), <Self as LayerTree>::Error>; | |
/// Replays the layer snapshot and returns canvas log. | |
fn snapshot_command_log(&mut self, snapshot_id: layer_tree::SnapshotId) -> Result<(Vec<Object>), <Self as LayerTree>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "layer_tree"))] | |
impl<T> LayerTree for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn compositing_reasons(&mut self, layer_id: layer_tree::LayerId) -> Result<(Vec<String>), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::CompositingReasonsRequest { layer_id }).map(|res| (res.compositing_reasons)) | |
} | |
fn disable(&mut self) -> Result<(), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::EnableRequest {}).map(|_| ()) | |
} | |
fn load_snapshot(&mut self, tiles: Vec<layer_tree::PictureTile>) -> Result<(layer_tree::SnapshotId), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::LoadSnapshotRequest { tiles }).map(|res| (res.snapshot_id)) | |
} | |
fn make_snapshot(&mut self, layer_id: layer_tree::LayerId) -> Result<(layer_tree::SnapshotId), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::MakeSnapshotRequest { layer_id }).map(|res| (res.snapshot_id)) | |
} | |
fn profile_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId, min_repeat_count: Option<Integer>, min_duration: Option<Number>, clip_rect: Option<dom::Rect>) -> Result<(Vec<layer_tree::PaintProfile>), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::ProfileSnapshotRequest { snapshot_id, min_repeat_count, min_duration, clip_rect }).map(|res| (res.timings)) | |
} | |
fn release_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId) -> Result<(), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::ReleaseSnapshotRequest { snapshot_id }).map(|_| ()) | |
} | |
fn replay_snapshot(&mut self, snapshot_id: layer_tree::SnapshotId, from_step: Option<Integer>, to_step: Option<Integer>, scale: Option<Number>) -> Result<(String), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::ReplaySnapshotRequest { snapshot_id, from_step, to_step, scale }).map(|res| (res.data_url)) | |
} | |
fn snapshot_command_log(&mut self, snapshot_id: layer_tree::SnapshotId) -> Result<(Vec<Object>), <Self as LayerTree>::Error> { | |
CallSite::call(self, layer_tree::SnapshotCommandLogRequest { snapshot_id }).map(|res| (res.command_log)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "layer_tree")))] | |
pub trait AsyncLayerTree: AsyncDOM where Self: Sized { | |
type Error; | |
type CompositingReasons: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type LoadSnapshot: futures::Future<Item = ((layer_tree::SnapshotId), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type MakeSnapshot: futures::Future<Item = ((layer_tree::SnapshotId), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type ProfileSnapshot: futures::Future<Item = ((Vec<layer_tree::PaintProfile>), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type ReleaseSnapshot: futures::Future<Item = ((), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type ReplaySnapshot: futures::Future<Item = ((String), Self), Error = <Self as AsyncLayerTree>::Error>; | |
type SnapshotCommandLog: futures::Future<Item = ((Vec<Object>), Self), Error = <Self as AsyncLayerTree>::Error>; | |
/// Provides the reasons why the given layer was composited. | |
fn compositing_reasons(self, layer_id: layer_tree::LayerId) -> <Self as AsyncLayerTree>::CompositingReasons; | |
/// Disables compositing tree inspection. | |
fn disable(self) -> <Self as AsyncLayerTree>::Disable; | |
/// Enables compositing tree inspection. | |
fn enable(self) -> <Self as AsyncLayerTree>::Enable; | |
/// Returns the snapshot identifier. | |
fn load_snapshot(self, tiles: Vec<layer_tree::PictureTile>) -> <Self as AsyncLayerTree>::LoadSnapshot; | |
/// Returns the layer snapshot identifier. | |
fn make_snapshot(self, layer_id: layer_tree::LayerId) -> <Self as AsyncLayerTree>::MakeSnapshot; | |
fn profile_snapshot(self, snapshot_id: layer_tree::SnapshotId, min_repeat_count: Option<Integer>, min_duration: Option<Number>, clip_rect: Option<dom::Rect>) -> <Self as AsyncLayerTree>::ProfileSnapshot; | |
/// Releases layer snapshot captured by the back-end. | |
fn release_snapshot(self, snapshot_id: layer_tree::SnapshotId) -> <Self as AsyncLayerTree>::ReleaseSnapshot; | |
/// Replays the layer snapshot and returns the resulting bitmap. | |
fn replay_snapshot(self, snapshot_id: layer_tree::SnapshotId, from_step: Option<Integer>, to_step: Option<Integer>, scale: Option<Number>) -> <Self as AsyncLayerTree>::ReplaySnapshot; | |
/// Replays the layer snapshot and returns canvas log. | |
fn snapshot_command_log(self, snapshot_id: layer_tree::SnapshotId) -> <Self as AsyncLayerTree>::SnapshotCommandLog; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "layer_tree")))] | |
impl<T> AsyncLayerTree for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type CompositingReasons = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type LoadSnapshot = Box<dyn futures::Future<Item = ((layer_tree::SnapshotId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type MakeSnapshot = Box<dyn futures::Future<Item = ((layer_tree::SnapshotId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ProfileSnapshot = Box<dyn futures::Future<Item = ((Vec<layer_tree::PaintProfile>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ReleaseSnapshot = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ReplaySnapshot = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SnapshotCommandLog = Box<dyn futures::Future<Item = ((Vec<Object>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn compositing_reasons(self, layer_id: layer_tree::LayerId) -> <Self as AsyncLayerTree>::CompositingReasons { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::CompositingReasonsRequest { layer_id }).map(|(res, self_)| ((res.compositing_reasons), self_))) | |
} | |
fn disable(self) -> <Self as AsyncLayerTree>::Disable { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncLayerTree>::Enable { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn load_snapshot(self, tiles: Vec<layer_tree::PictureTile>) -> <Self as AsyncLayerTree>::LoadSnapshot { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::LoadSnapshotRequest { tiles }).map(|(res, self_)| ((res.snapshot_id), self_))) | |
} | |
fn make_snapshot(self, layer_id: layer_tree::LayerId) -> <Self as AsyncLayerTree>::MakeSnapshot { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::MakeSnapshotRequest { layer_id }).map(|(res, self_)| ((res.snapshot_id), self_))) | |
} | |
fn profile_snapshot(self, snapshot_id: layer_tree::SnapshotId, min_repeat_count: Option<Integer>, min_duration: Option<Number>, clip_rect: Option<dom::Rect>) -> <Self as AsyncLayerTree>::ProfileSnapshot { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::ProfileSnapshotRequest { snapshot_id, min_repeat_count, min_duration, clip_rect }).map(|(res, self_)| ((res.timings), self_))) | |
} | |
fn release_snapshot(self, snapshot_id: layer_tree::SnapshotId) -> <Self as AsyncLayerTree>::ReleaseSnapshot { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::ReleaseSnapshotRequest { snapshot_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn replay_snapshot(self, snapshot_id: layer_tree::SnapshotId, from_step: Option<Integer>, to_step: Option<Integer>, scale: Option<Number>) -> <Self as AsyncLayerTree>::ReplaySnapshot { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::ReplaySnapshotRequest { snapshot_id, from_step, to_step, scale }).map(|(res, self_)| ((res.data_url), self_))) | |
} | |
fn snapshot_command_log(self, snapshot_id: layer_tree::SnapshotId) -> <Self as AsyncLayerTree>::SnapshotCommandLog { | |
Box::new(AsyncCallSite::async_call(self, layer_tree::SnapshotCommandLogRequest { snapshot_id }).map(|(res, self_)| ((res.command_log), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "layer_tree"))] | |
#[allow(deprecated)] | |
pub mod layer_tree { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique Layer identifier. | |
pub type LayerId = String; | |
/// Unique snapshot identifier. | |
pub type SnapshotId = String; | |
/// Rectangle where scrolling happens on the main thread. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ScrollRect { | |
/// Rectangle itself. | |
pub rect: dom::Rect, | |
/// Reason for rectangle to force scrolling on the main thread | |
#[serde(rename = "type")] | |
pub r#type: ScrollRectType, | |
} | |
/// Allow values for the `ScrollRect::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ScrollRectType { | |
RepaintsOnScroll, | |
TouchEventHandler, | |
WheelEventHandler, | |
} | |
/// Sticky position constraints. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StickyPositionConstraint { | |
/// Layout rectangle of the sticky element before being shifted | |
pub sticky_box_rect: dom::Rect, | |
/// Layout rectangle of the containing block of the sticky element | |
pub containing_block_rect: dom::Rect, | |
/// The nearest sticky layer that shifts the sticky box | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub nearest_layer_shifting_sticky_box: Option<LayerId>, | |
/// The nearest sticky layer that shifts the containing block | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub nearest_layer_shifting_containing_block: Option<LayerId>, | |
} | |
/// Serialized fragment of layer picture along with its offset within the layer. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PictureTile { | |
/// Offset from owning layer left boundary | |
pub x: Number, | |
/// Offset from owning layer top boundary | |
pub y: Number, | |
/// Base64-encoded snapshot data. | |
pub picture: Binary, | |
} | |
/// Information about a compositing layer. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Layer { | |
/// The unique id for this layer. | |
pub layer_id: LayerId, | |
/// The id of parent (not present for root). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub parent_layer_id: Option<LayerId>, | |
/// The backend id for the node associated with this layer. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
/// Offset from parent layer, X coordinate. | |
pub offset_x: Number, | |
/// Offset from parent layer, Y coordinate. | |
pub offset_y: Number, | |
/// Layer width. | |
pub width: Number, | |
/// Layer height. | |
pub height: Number, | |
/// Transformation matrix for layer, default is identity matrix | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub transform: Option<Vec<Number>>, | |
/// Transform anchor point X, absent if no transform specified | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub anchor_x: Option<Number>, | |
/// Transform anchor point Y, absent if no transform specified | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub anchor_y: Option<Number>, | |
/// Transform anchor point Z, absent if no transform specified | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub anchor_z: Option<Number>, | |
/// Indicates how many time this layer has painted. | |
pub paint_count: Integer, | |
/// Indicates whether this layer hosts any content, rather than being used for | |
/// transform/scrolling purposes only. | |
pub draws_content: Boolean, | |
/// Set if layer is not visible. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub invisible: Option<Boolean>, | |
/// Rectangles scrolling on main thread only. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scroll_rects: Option<Vec<ScrollRect>>, | |
/// Sticky position constraint information | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sticky_position_constraint: Option<StickyPositionConstraint>, | |
} | |
/// Array of timings, one per paint step. | |
pub type PaintProfile = Vec<Number>; | |
/// Method parameters of the `LayerTree::compositingReasons` command. | |
pub type CompositingReasons = CompositingReasonsRequest; | |
/// Return object of the `LayerTree::compositingReasons` command. | |
pub type CompositingReasonsReturnObject = CompositingReasonsResponse; | |
/// Request object of the `LayerTree::compositingReasons` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CompositingReasonsRequest { | |
/// The id of the layer for which we want to get the reasons it was composited. | |
pub layer_id: LayerId, | |
} | |
/// Response object of the `LayerTree::compositingReasons` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CompositingReasonsResponse { | |
/// A list of strings specifying reasons for the given layer to become composited. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub compositing_reasons: Vec<String>, | |
} | |
impl Method for CompositingReasons { | |
const NAME: &'static str = "LayerTree.compositingReasons"; | |
type ReturnObject = CompositingReasonsReturnObject; | |
} | |
/// Method parameters of the `LayerTree::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `LayerTree::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `LayerTree::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `LayerTree::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "LayerTree.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `LayerTree::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `LayerTree::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `LayerTree::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `LayerTree::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "LayerTree.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `LayerTree::loadSnapshot` command. | |
pub type LoadSnapshot = LoadSnapshotRequest; | |
/// Return object of the `LayerTree::loadSnapshot` command. | |
pub type LoadSnapshotReturnObject = LoadSnapshotResponse; | |
/// Request object of the `LayerTree::loadSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LoadSnapshotRequest { | |
/// An array of tiles composing the snapshot. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub tiles: Vec<PictureTile>, | |
} | |
/// Response object of the `LayerTree::loadSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LoadSnapshotResponse { | |
/// The id of the snapshot. | |
pub snapshot_id: SnapshotId, | |
} | |
impl Method for LoadSnapshot { | |
const NAME: &'static str = "LayerTree.loadSnapshot"; | |
type ReturnObject = LoadSnapshotReturnObject; | |
} | |
/// Method parameters of the `LayerTree::makeSnapshot` command. | |
pub type MakeSnapshot = MakeSnapshotRequest; | |
/// Return object of the `LayerTree::makeSnapshot` command. | |
pub type MakeSnapshotReturnObject = MakeSnapshotResponse; | |
/// Request object of the `LayerTree::makeSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MakeSnapshotRequest { | |
/// The id of the layer. | |
pub layer_id: LayerId, | |
} | |
/// Response object of the `LayerTree::makeSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct MakeSnapshotResponse { | |
/// The id of the layer snapshot. | |
pub snapshot_id: SnapshotId, | |
} | |
impl Method for MakeSnapshot { | |
const NAME: &'static str = "LayerTree.makeSnapshot"; | |
type ReturnObject = MakeSnapshotReturnObject; | |
} | |
/// Method parameters of the `LayerTree::profileSnapshot` command. | |
pub type ProfileSnapshot = ProfileSnapshotRequest; | |
/// Return object of the `LayerTree::profileSnapshot` command. | |
pub type ProfileSnapshotReturnObject = ProfileSnapshotResponse; | |
/// Request object of the `LayerTree::profileSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ProfileSnapshotRequest { | |
/// The id of the layer snapshot. | |
pub snapshot_id: SnapshotId, | |
/// The maximum number of times to replay the snapshot (1, if not specified). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub min_repeat_count: Option<Integer>, | |
/// The minimum duration (in seconds) to replay the snapshot. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub min_duration: Option<Number>, | |
/// The clip rectangle to apply when replaying the snapshot. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub clip_rect: Option<dom::Rect>, | |
} | |
/// Response object of the `LayerTree::profileSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ProfileSnapshotResponse { | |
/// The array of paint profiles, one per run. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub timings: Vec<PaintProfile>, | |
} | |
impl Method for ProfileSnapshot { | |
const NAME: &'static str = "LayerTree.profileSnapshot"; | |
type ReturnObject = ProfileSnapshotReturnObject; | |
} | |
/// Method parameters of the `LayerTree::releaseSnapshot` command. | |
pub type ReleaseSnapshot = ReleaseSnapshotRequest; | |
/// Return object of the `LayerTree::releaseSnapshot` command. | |
pub type ReleaseSnapshotReturnObject = ReleaseSnapshotResponse; | |
/// Request object of the `LayerTree::releaseSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReleaseSnapshotRequest { | |
/// The id of the layer snapshot. | |
pub snapshot_id: SnapshotId, | |
} | |
/// Response object of the `LayerTree::releaseSnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReleaseSnapshotResponse { | |
} | |
impl Method for ReleaseSnapshot { | |
const NAME: &'static str = "LayerTree.releaseSnapshot"; | |
type ReturnObject = ReleaseSnapshotReturnObject; | |
} | |
/// Method parameters of the `LayerTree::replaySnapshot` command. | |
pub type ReplaySnapshot = ReplaySnapshotRequest; | |
/// Return object of the `LayerTree::replaySnapshot` command. | |
pub type ReplaySnapshotReturnObject = ReplaySnapshotResponse; | |
/// Request object of the `LayerTree::replaySnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReplaySnapshotRequest { | |
/// The id of the layer snapshot. | |
pub snapshot_id: SnapshotId, | |
/// The first step to replay from (replay from the very start if not specified). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub from_step: Option<Integer>, | |
/// The last step to replay to (replay till the end if not specified). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub to_step: Option<Integer>, | |
/// The scale to apply while replaying (defaults to 1). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scale: Option<Number>, | |
} | |
/// Response object of the `LayerTree::replaySnapshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReplaySnapshotResponse { | |
/// A data: URL for resulting image. | |
#[serde(rename = "dataURL")] | |
pub data_url: String, | |
} | |
impl Method for ReplaySnapshot { | |
const NAME: &'static str = "LayerTree.replaySnapshot"; | |
type ReturnObject = ReplaySnapshotReturnObject; | |
} | |
/// Method parameters of the `LayerTree::snapshotCommandLog` command. | |
pub type SnapshotCommandLog = SnapshotCommandLogRequest; | |
/// Return object of the `LayerTree::snapshotCommandLog` command. | |
pub type SnapshotCommandLogReturnObject = SnapshotCommandLogResponse; | |
/// Request object of the `LayerTree::snapshotCommandLog` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SnapshotCommandLogRequest { | |
/// The id of the layer snapshot. | |
pub snapshot_id: SnapshotId, | |
} | |
/// Response object of the `LayerTree::snapshotCommandLog` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SnapshotCommandLogResponse { | |
/// The array of canvas function calls. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub command_log: Vec<Object>, | |
} | |
impl Method for SnapshotCommandLog { | |
const NAME: &'static str = "LayerTree.snapshotCommandLog"; | |
type ReturnObject = SnapshotCommandLogReturnObject; | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LayerPaintedEvent { | |
/// The id of the painted layer. | |
pub layer_id: LayerId, | |
/// Clip rectangle. | |
pub clip: dom::Rect, | |
} | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LayerTreeDidChangeEvent { | |
/// Layer tree, absent if not in the comspositing mode. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub layers: Option<Vec<Layer>>, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
#[serde(rename = "LayerTree.layerPainted")] | |
LayerPainted(LayerPaintedEvent), | |
#[serde(rename = "LayerTree.layerTreeDidChange")] | |
LayerTreeDidChange(LayerTreeDidChangeEvent), | |
} | |
} | |
/// Provides access to log entries. | |
#[cfg(any(feature = "all", feature = "log"))] | |
pub trait Log: Runtime + Network { | |
type Error; | |
/// Clears the log. | |
fn clear(&mut self) -> Result<(), <Self as Log>::Error>; | |
/// Disables log domain, prevents further log entries from being reported to the client. | |
fn disable(&mut self) -> Result<(), <Self as Log>::Error>; | |
/// Enables log domain, sends the entries collected so far to the client by means of the | |
/// `entryAdded` notification. | |
fn enable(&mut self) -> Result<(), <Self as Log>::Error>; | |
/// start violation reporting. | |
fn start_violations_report(&mut self, config: Vec<log::ViolationSetting>) -> Result<(), <Self as Log>::Error>; | |
/// Stop violation reporting. | |
fn stop_violations_report(&mut self) -> Result<(), <Self as Log>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "log"))] | |
impl<T> Log for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn clear(&mut self) -> Result<(), <Self as Log>::Error> { | |
CallSite::call(self, log::ClearRequest {}).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as Log>::Error> { | |
CallSite::call(self, log::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Log>::Error> { | |
CallSite::call(self, log::EnableRequest {}).map(|_| ()) | |
} | |
fn start_violations_report(&mut self, config: Vec<log::ViolationSetting>) -> Result<(), <Self as Log>::Error> { | |
CallSite::call(self, log::StartViolationsReportRequest { config }).map(|_| ()) | |
} | |
fn stop_violations_report(&mut self) -> Result<(), <Self as Log>::Error> { | |
CallSite::call(self, log::StopViolationsReportRequest {}).map(|_| ()) | |
} | |
} | |
/// Provides access to log entries. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "log")))] | |
pub trait AsyncLog: AsyncRuntime + AsyncNetwork where Self: Sized { | |
type Error; | |
type Clear: futures::Future<Item = ((), Self), Error = <Self as AsyncLog>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncLog>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncLog>::Error>; | |
type StartViolationsReport: futures::Future<Item = ((), Self), Error = <Self as AsyncLog>::Error>; | |
type StopViolationsReport: futures::Future<Item = ((), Self), Error = <Self as AsyncLog>::Error>; | |
/// Clears the log. | |
fn clear(self) -> <Self as AsyncLog>::Clear; | |
/// Disables log domain, prevents further log entries from being reported to the client. | |
fn disable(self) -> <Self as AsyncLog>::Disable; | |
/// Enables log domain, sends the entries collected so far to the client by means of the | |
/// `entryAdded` notification. | |
fn enable(self) -> <Self as AsyncLog>::Enable; | |
/// start violation reporting. | |
fn start_violations_report(self, config: Vec<log::ViolationSetting>) -> <Self as AsyncLog>::StartViolationsReport; | |
/// Stop violation reporting. | |
fn stop_violations_report(self) -> <Self as AsyncLog>::StopViolationsReport; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "log")))] | |
impl<T> AsyncLog for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Clear = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StartViolationsReport = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopViolationsReport = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn clear(self) -> <Self as AsyncLog>::Clear { | |
Box::new(AsyncCallSite::async_call(self, log::ClearRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncLog>::Disable { | |
Box::new(AsyncCallSite::async_call(self, log::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncLog>::Enable { | |
Box::new(AsyncCallSite::async_call(self, log::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn start_violations_report(self, config: Vec<log::ViolationSetting>) -> <Self as AsyncLog>::StartViolationsReport { | |
Box::new(AsyncCallSite::async_call(self, log::StartViolationsReportRequest { config }).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_violations_report(self) -> <Self as AsyncLog>::StopViolationsReport { | |
Box::new(AsyncCallSite::async_call(self, log::StopViolationsReportRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// Provides access to log entries. | |
#[cfg(any(feature = "all", feature = "log"))] | |
#[allow(deprecated)] | |
pub mod log { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Log entry. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LogEntry { | |
/// Log entry source. | |
pub source: LogEntrySource, | |
/// Log entry severity. | |
pub level: LogEntryLevel, | |
/// Logged text. | |
pub text: String, | |
/// Timestamp when this entry was added. | |
pub timestamp: runtime::Timestamp, | |
/// URL of the resource if known. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// Line number in the resource. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub line_number: Option<Integer>, | |
/// JavaScript stack trace. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub stack_trace: Option<runtime::StackTrace>, | |
/// Identifier of the network request associated with this entry. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub network_request_id: Option<network::RequestId>, | |
/// Identifier of the worker associated with this entry. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub worker_id: Option<String>, | |
/// Call arguments. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub args: Option<Vec<runtime::RemoteObject>>, | |
} | |
/// Allow values for the `LogEntry::source` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum LogEntrySource { | |
Xml, | |
Javascript, | |
Network, | |
Storage, | |
Appcache, | |
Rendering, | |
Security, | |
Deprecation, | |
Worker, | |
Violation, | |
Intervention, | |
Recommendation, | |
Other, | |
} | |
/// Allow values for the `LogEntry::level` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum LogEntryLevel { | |
Verbose, | |
Info, | |
Warning, | |
Error, | |
} | |
/// Violation configuration setting. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ViolationSetting { | |
/// Violation type. | |
pub name: ViolationSettingName, | |
/// Time threshold to trigger upon. | |
pub threshold: Number, | |
} | |
/// Allow values for the `ViolationSetting::name` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ViolationSettingName { | |
LongTask, | |
LongLayout, | |
BlockedEvent, | |
BlockedParser, | |
DiscouragedAPIUse, | |
Handler, | |
RecurringHandler, | |
} | |
/// Method parameters of the `Log::clear` command. | |
pub type Clear = ClearRequest; | |
/// Return object of the `Log::clear` command. | |
pub type ClearReturnObject = ClearResponse; | |
/// Request object of the `Log::clear` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearRequest { | |
} | |
/// Response object of the `Log::clear` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearResponse { | |
} | |
impl Method for Clear { | |
const NAME: &'static str = "Log.clear"; | |
type ReturnObject = ClearReturnObject; | |
} | |
/// Method parameters of the `Log::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Log::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Log::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Log::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Log.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Log::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Log::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Log::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Log::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Log.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Log::startViolationsReport` command. | |
pub type StartViolationsReport = StartViolationsReportRequest; | |
/// Return object of the `Log::startViolationsReport` command. | |
pub type StartViolationsReportReturnObject = StartViolationsReportResponse; | |
/// Request object of the `Log::startViolationsReport` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartViolationsReportRequest { | |
/// Configuration for violations. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub config: Vec<ViolationSetting>, | |
} | |
/// Response object of the `Log::startViolationsReport` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartViolationsReportResponse { | |
} | |
impl Method for StartViolationsReport { | |
const NAME: &'static str = "Log.startViolationsReport"; | |
type ReturnObject = StartViolationsReportReturnObject; | |
} | |
/// Method parameters of the `Log::stopViolationsReport` command. | |
pub type StopViolationsReport = StopViolationsReportRequest; | |
/// Return object of the `Log::stopViolationsReport` command. | |
pub type StopViolationsReportReturnObject = StopViolationsReportResponse; | |
/// Request object of the `Log::stopViolationsReport` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopViolationsReportRequest { | |
} | |
/// Response object of the `Log::stopViolationsReport` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopViolationsReportResponse { | |
} | |
impl Method for StopViolationsReport { | |
const NAME: &'static str = "Log.stopViolationsReport"; | |
type ReturnObject = StopViolationsReportReturnObject; | |
} | |
/// Issued when new message was logged. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EntryAddedEvent { | |
/// The entry. | |
pub entry: LogEntry, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Issued when new message was logged. | |
#[serde(rename = "Log.entryAdded")] | |
EntryAdded(EntryAddedEvent), | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "memory"))] | |
pub trait Memory { | |
type Error; | |
fn get_dom_counters(&mut self) -> Result<(Integer, Integer, Integer), <Self as Memory>::Error>; | |
fn prepare_for_leak_detection(&mut self) -> Result<(), <Self as Memory>::Error>; | |
/// Simulate OomIntervention by purging V8 memory. | |
fn forcibly_purge_java_script_memory(&mut self) -> Result<(), <Self as Memory>::Error>; | |
/// Enable/disable suppressing memory pressure notifications in all processes. | |
fn set_pressure_notifications_suppressed(&mut self, suppressed: Boolean) -> Result<(), <Self as Memory>::Error>; | |
/// Simulate a memory pressure notification in all processes. | |
fn simulate_pressure_notification(&mut self, level: memory::PressureLevel) -> Result<(), <Self as Memory>::Error>; | |
/// Start collecting native memory profile. | |
fn start_sampling(&mut self, sampling_interval: Option<Integer>, suppress_randomness: Option<Boolean>) -> Result<(), <Self as Memory>::Error>; | |
/// Stop collecting native memory profile. | |
fn stop_sampling(&mut self) -> Result<(), <Self as Memory>::Error>; | |
/// Retrieve native memory allocations profile | |
/// collected since renderer process startup. | |
fn get_all_time_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error>; | |
/// Retrieve native memory allocations profile | |
/// collected since browser process startup. | |
fn get_browser_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error>; | |
/// Retrieve native memory allocations profile collected since last | |
/// `startSampling` call. | |
fn get_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "memory"))] | |
impl<T> Memory for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn get_dom_counters(&mut self) -> Result<(Integer, Integer, Integer), <Self as Memory>::Error> { | |
CallSite::call(self, memory::GetDOMCountersRequest {}).map(|res| (res.documents, res.nodes, res.js_event_listeners)) | |
} | |
fn prepare_for_leak_detection(&mut self) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::PrepareForLeakDetectionRequest {}).map(|_| ()) | |
} | |
fn forcibly_purge_java_script_memory(&mut self) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::ForciblyPurgeJavaScriptMemoryRequest {}).map(|_| ()) | |
} | |
fn set_pressure_notifications_suppressed(&mut self, suppressed: Boolean) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::SetPressureNotificationsSuppressedRequest { suppressed }).map(|_| ()) | |
} | |
fn simulate_pressure_notification(&mut self, level: memory::PressureLevel) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::SimulatePressureNotificationRequest { level }).map(|_| ()) | |
} | |
fn start_sampling(&mut self, sampling_interval: Option<Integer>, suppress_randomness: Option<Boolean>) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::StartSamplingRequest { sampling_interval, suppress_randomness }).map(|_| ()) | |
} | |
fn stop_sampling(&mut self) -> Result<(), <Self as Memory>::Error> { | |
CallSite::call(self, memory::StopSamplingRequest {}).map(|_| ()) | |
} | |
fn get_all_time_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error> { | |
CallSite::call(self, memory::GetAllTimeSamplingProfileRequest {}).map(|res| (res.profile)) | |
} | |
fn get_browser_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error> { | |
CallSite::call(self, memory::GetBrowserSamplingProfileRequest {}).map(|res| (res.profile)) | |
} | |
fn get_sampling_profile(&mut self) -> Result<(memory::SamplingProfile), <Self as Memory>::Error> { | |
CallSite::call(self, memory::GetSamplingProfileRequest {}).map(|res| (res.profile)) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "memory")))] | |
pub trait AsyncMemory where Self: Sized { | |
type Error; | |
type GetDOMCounters: futures::Future<Item = ((Integer, Integer, Integer), Self), Error = <Self as AsyncMemory>::Error>; | |
type PrepareForLeakDetection: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type ForciblyPurgeJavaScriptMemory: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type SetPressureNotificationsSuppressed: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type SimulatePressureNotification: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type StartSampling: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type StopSampling: futures::Future<Item = ((), Self), Error = <Self as AsyncMemory>::Error>; | |
type GetAllTimeSamplingProfile: futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncMemory>::Error>; | |
type GetBrowserSamplingProfile: futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncMemory>::Error>; | |
type GetSamplingProfile: futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncMemory>::Error>; | |
fn get_dom_counters(self) -> <Self as AsyncMemory>::GetDOMCounters; | |
fn prepare_for_leak_detection(self) -> <Self as AsyncMemory>::PrepareForLeakDetection; | |
/// Simulate OomIntervention by purging V8 memory. | |
fn forcibly_purge_java_script_memory(self) -> <Self as AsyncMemory>::ForciblyPurgeJavaScriptMemory; | |
/// Enable/disable suppressing memory pressure notifications in all processes. | |
fn set_pressure_notifications_suppressed(self, suppressed: Boolean) -> <Self as AsyncMemory>::SetPressureNotificationsSuppressed; | |
/// Simulate a memory pressure notification in all processes. | |
fn simulate_pressure_notification(self, level: memory::PressureLevel) -> <Self as AsyncMemory>::SimulatePressureNotification; | |
/// Start collecting native memory profile. | |
fn start_sampling(self, sampling_interval: Option<Integer>, suppress_randomness: Option<Boolean>) -> <Self as AsyncMemory>::StartSampling; | |
/// Stop collecting native memory profile. | |
fn stop_sampling(self) -> <Self as AsyncMemory>::StopSampling; | |
/// Retrieve native memory allocations profile | |
/// collected since renderer process startup. | |
fn get_all_time_sampling_profile(self) -> <Self as AsyncMemory>::GetAllTimeSamplingProfile; | |
/// Retrieve native memory allocations profile | |
/// collected since browser process startup. | |
fn get_browser_sampling_profile(self) -> <Self as AsyncMemory>::GetBrowserSamplingProfile; | |
/// Retrieve native memory allocations profile collected since last | |
/// `startSampling` call. | |
fn get_sampling_profile(self) -> <Self as AsyncMemory>::GetSamplingProfile; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "memory")))] | |
impl<T> AsyncMemory for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type GetDOMCounters = Box<dyn futures::Future<Item = ((Integer, Integer, Integer), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type PrepareForLeakDetection = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ForciblyPurgeJavaScriptMemory = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetPressureNotificationsSuppressed = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SimulatePressureNotification = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StartSampling = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopSampling = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetAllTimeSamplingProfile = Box<dyn futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetBrowserSamplingProfile = Box<dyn futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetSamplingProfile = Box<dyn futures::Future<Item = ((memory::SamplingProfile), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn get_dom_counters(self) -> <Self as AsyncMemory>::GetDOMCounters { | |
Box::new(AsyncCallSite::async_call(self, memory::GetDOMCountersRequest {}).map(|(res, self_)| ((res.documents, res.nodes, res.js_event_listeners), self_))) | |
} | |
fn prepare_for_leak_detection(self) -> <Self as AsyncMemory>::PrepareForLeakDetection { | |
Box::new(AsyncCallSite::async_call(self, memory::PrepareForLeakDetectionRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn forcibly_purge_java_script_memory(self) -> <Self as AsyncMemory>::ForciblyPurgeJavaScriptMemory { | |
Box::new(AsyncCallSite::async_call(self, memory::ForciblyPurgeJavaScriptMemoryRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn set_pressure_notifications_suppressed(self, suppressed: Boolean) -> <Self as AsyncMemory>::SetPressureNotificationsSuppressed { | |
Box::new(AsyncCallSite::async_call(self, memory::SetPressureNotificationsSuppressedRequest { suppressed }).map(|(_, self_)| ((), self_))) | |
} | |
fn simulate_pressure_notification(self, level: memory::PressureLevel) -> <Self as AsyncMemory>::SimulatePressureNotification { | |
Box::new(AsyncCallSite::async_call(self, memory::SimulatePressureNotificationRequest { level }).map(|(_, self_)| ((), self_))) | |
} | |
fn start_sampling(self, sampling_interval: Option<Integer>, suppress_randomness: Option<Boolean>) -> <Self as AsyncMemory>::StartSampling { | |
Box::new(AsyncCallSite::async_call(self, memory::StartSamplingRequest { sampling_interval, suppress_randomness }).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_sampling(self) -> <Self as AsyncMemory>::StopSampling { | |
Box::new(AsyncCallSite::async_call(self, memory::StopSamplingRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_all_time_sampling_profile(self) -> <Self as AsyncMemory>::GetAllTimeSamplingProfile { | |
Box::new(AsyncCallSite::async_call(self, memory::GetAllTimeSamplingProfileRequest {}).map(|(res, self_)| ((res.profile), self_))) | |
} | |
fn get_browser_sampling_profile(self) -> <Self as AsyncMemory>::GetBrowserSamplingProfile { | |
Box::new(AsyncCallSite::async_call(self, memory::GetBrowserSamplingProfileRequest {}).map(|(res, self_)| ((res.profile), self_))) | |
} | |
fn get_sampling_profile(self) -> <Self as AsyncMemory>::GetSamplingProfile { | |
Box::new(AsyncCallSite::async_call(self, memory::GetSamplingProfileRequest {}).map(|(res, self_)| ((res.profile), self_))) | |
} | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "memory"))] | |
#[allow(deprecated)] | |
pub mod memory { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Memory pressure level. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum PressureLevel { | |
Moderate, | |
Critical, | |
} | |
/// Heap profile sample. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SamplingProfileNode { | |
/// Size of the sampled allocation. | |
pub size: Number, | |
/// Total bytes attributed to this sample. | |
pub total: Number, | |
/// Execution stack at the point of allocation. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub stack: Vec<String>, | |
} | |
/// Array of heap profile samples. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SamplingProfile { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub samples: Vec<SamplingProfileNode>, | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub modules: Vec<Module>, | |
} | |
/// Executable module information | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Module { | |
/// Name of the module. | |
pub name: String, | |
/// UUID of the module. | |
pub uuid: String, | |
/// Base address where the module is loaded into memory. Encoded as a decimal | |
/// or hexadecimal (0x prefixed) string. | |
pub base_address: String, | |
/// Size of the module in bytes. | |
pub size: Number, | |
} | |
/// Method parameters of the `Memory::getDOMCounters` command. | |
pub type GetDOMCounters = GetDOMCountersRequest; | |
/// Return object of the `Memory::getDOMCounters` command. | |
pub type GetDOMCountersReturnObject = GetDOMCountersResponse; | |
/// Request object of the `Memory::getDOMCounters` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDOMCountersRequest { | |
} | |
/// Response object of the `Memory::getDOMCounters` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetDOMCountersResponse { | |
pub documents: Integer, | |
pub nodes: Integer, | |
pub js_event_listeners: Integer, | |
} | |
impl Method for GetDOMCounters { | |
const NAME: &'static str = "Memory.getDOMCounters"; | |
type ReturnObject = GetDOMCountersReturnObject; | |
} | |
/// Method parameters of the `Memory::prepareForLeakDetection` command. | |
pub type PrepareForLeakDetection = PrepareForLeakDetectionRequest; | |
/// Return object of the `Memory::prepareForLeakDetection` command. | |
pub type PrepareForLeakDetectionReturnObject = PrepareForLeakDetectionResponse; | |
/// Request object of the `Memory::prepareForLeakDetection` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PrepareForLeakDetectionRequest { | |
} | |
/// Response object of the `Memory::prepareForLeakDetection` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PrepareForLeakDetectionResponse { | |
} | |
impl Method for PrepareForLeakDetection { | |
const NAME: &'static str = "Memory.prepareForLeakDetection"; | |
type ReturnObject = PrepareForLeakDetectionReturnObject; | |
} | |
/// Method parameters of the `Memory::forciblyPurgeJavaScriptMemory` command. | |
pub type ForciblyPurgeJavaScriptMemory = ForciblyPurgeJavaScriptMemoryRequest; | |
/// Return object of the `Memory::forciblyPurgeJavaScriptMemory` command. | |
pub type ForciblyPurgeJavaScriptMemoryReturnObject = ForciblyPurgeJavaScriptMemoryResponse; | |
/// Request object of the `Memory::forciblyPurgeJavaScriptMemory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ForciblyPurgeJavaScriptMemoryRequest { | |
} | |
/// Response object of the `Memory::forciblyPurgeJavaScriptMemory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ForciblyPurgeJavaScriptMemoryResponse { | |
} | |
impl Method for ForciblyPurgeJavaScriptMemory { | |
const NAME: &'static str = "Memory.forciblyPurgeJavaScriptMemory"; | |
type ReturnObject = ForciblyPurgeJavaScriptMemoryReturnObject; | |
} | |
/// Method parameters of the `Memory::setPressureNotificationsSuppressed` command. | |
pub type SetPressureNotificationsSuppressed = SetPressureNotificationsSuppressedRequest; | |
/// Return object of the `Memory::setPressureNotificationsSuppressed` command. | |
pub type SetPressureNotificationsSuppressedReturnObject = SetPressureNotificationsSuppressedResponse; | |
/// Request object of the `Memory::setPressureNotificationsSuppressed` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPressureNotificationsSuppressedRequest { | |
/// If true, memory pressure notifications will be suppressed. | |
pub suppressed: Boolean, | |
} | |
/// Response object of the `Memory::setPressureNotificationsSuppressed` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPressureNotificationsSuppressedResponse { | |
} | |
impl Method for SetPressureNotificationsSuppressed { | |
const NAME: &'static str = "Memory.setPressureNotificationsSuppressed"; | |
type ReturnObject = SetPressureNotificationsSuppressedReturnObject; | |
} | |
/// Method parameters of the `Memory::simulatePressureNotification` command. | |
pub type SimulatePressureNotification = SimulatePressureNotificationRequest; | |
/// Return object of the `Memory::simulatePressureNotification` command. | |
pub type SimulatePressureNotificationReturnObject = SimulatePressureNotificationResponse; | |
/// Request object of the `Memory::simulatePressureNotification` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SimulatePressureNotificationRequest { | |
/// Memory pressure level of the notification. | |
pub level: PressureLevel, | |
} | |
/// Response object of the `Memory::simulatePressureNotification` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SimulatePressureNotificationResponse { | |
} | |
impl Method for SimulatePressureNotification { | |
const NAME: &'static str = "Memory.simulatePressureNotification"; | |
type ReturnObject = SimulatePressureNotificationReturnObject; | |
} | |
/// Method parameters of the `Memory::startSampling` command. | |
pub type StartSampling = StartSamplingRequest; | |
/// Return object of the `Memory::startSampling` command. | |
pub type StartSamplingReturnObject = StartSamplingResponse; | |
/// Request object of the `Memory::startSampling` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartSamplingRequest { | |
/// Average number of bytes between samples. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sampling_interval: Option<Integer>, | |
/// Do not randomize intervals between samples. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub suppress_randomness: Option<Boolean>, | |
} | |
/// Response object of the `Memory::startSampling` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StartSamplingResponse { | |
} | |
impl Method for StartSampling { | |
const NAME: &'static str = "Memory.startSampling"; | |
type ReturnObject = StartSamplingReturnObject; | |
} | |
/// Method parameters of the `Memory::stopSampling` command. | |
pub type StopSampling = StopSamplingRequest; | |
/// Return object of the `Memory::stopSampling` command. | |
pub type StopSamplingReturnObject = StopSamplingResponse; | |
/// Request object of the `Memory::stopSampling` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopSamplingRequest { | |
} | |
/// Response object of the `Memory::stopSampling` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct StopSamplingResponse { | |
} | |
impl Method for StopSampling { | |
const NAME: &'static str = "Memory.stopSampling"; | |
type ReturnObject = StopSamplingReturnObject; | |
} | |
/// Method parameters of the `Memory::getAllTimeSamplingProfile` command. | |
pub type GetAllTimeSamplingProfile = GetAllTimeSamplingProfileRequest; | |
/// Return object of the `Memory::getAllTimeSamplingProfile` command. | |
pub type GetAllTimeSamplingProfileReturnObject = GetAllTimeSamplingProfileResponse; | |
/// Request object of the `Memory::getAllTimeSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAllTimeSamplingProfileRequest { | |
} | |
/// Response object of the `Memory::getAllTimeSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAllTimeSamplingProfileResponse { | |
pub profile: SamplingProfile, | |
} | |
impl Method for GetAllTimeSamplingProfile { | |
const NAME: &'static str = "Memory.getAllTimeSamplingProfile"; | |
type ReturnObject = GetAllTimeSamplingProfileReturnObject; | |
} | |
/// Method parameters of the `Memory::getBrowserSamplingProfile` command. | |
pub type GetBrowserSamplingProfile = GetBrowserSamplingProfileRequest; | |
/// Return object of the `Memory::getBrowserSamplingProfile` command. | |
pub type GetBrowserSamplingProfileReturnObject = GetBrowserSamplingProfileResponse; | |
/// Request object of the `Memory::getBrowserSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBrowserSamplingProfileRequest { | |
} | |
/// Response object of the `Memory::getBrowserSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetBrowserSamplingProfileResponse { | |
pub profile: SamplingProfile, | |
} | |
impl Method for GetBrowserSamplingProfile { | |
const NAME: &'static str = "Memory.getBrowserSamplingProfile"; | |
type ReturnObject = GetBrowserSamplingProfileReturnObject; | |
} | |
/// Method parameters of the `Memory::getSamplingProfile` command. | |
pub type GetSamplingProfile = GetSamplingProfileRequest; | |
/// Return object of the `Memory::getSamplingProfile` command. | |
pub type GetSamplingProfileReturnObject = GetSamplingProfileResponse; | |
/// Request object of the `Memory::getSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSamplingProfileRequest { | |
} | |
/// Response object of the `Memory::getSamplingProfile` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetSamplingProfileResponse { | |
pub profile: SamplingProfile, | |
} | |
impl Method for GetSamplingProfile { | |
const NAME: &'static str = "Memory.getSamplingProfile"; | |
type ReturnObject = GetSamplingProfileReturnObject; | |
} | |
} | |
/// Network domain allows tracking network activities of the page. It exposes information about http, | |
/// file, data and other requests and responses, their headers, bodies, timing, etc. | |
#[cfg(any(feature = "all", feature = "network"))] | |
pub trait Network: Debugger + Runtime + Security { | |
type Error; | |
/// Tells whether clearing browser cache is supported. | |
#[deprecated] | |
fn can_clear_browser_cache(&mut self) -> Result<(Boolean), <Self as Network>::Error>; | |
/// Tells whether clearing browser cookies is supported. | |
#[deprecated] | |
fn can_clear_browser_cookies(&mut self) -> Result<(Boolean), <Self as Network>::Error>; | |
/// Tells whether emulation of network conditions is supported. | |
#[deprecated] | |
fn can_emulate_network_conditions(&mut self) -> Result<(Boolean), <Self as Network>::Error>; | |
/// Clears browser cache. | |
fn clear_browser_cache(&mut self) -> Result<(), <Self as Network>::Error>; | |
/// Clears browser cookies. | |
fn clear_browser_cookies(&mut self) -> Result<(), <Self as Network>::Error>; | |
/// Response to Network.requestIntercepted which either modifies the request to continue with any | |
/// modifications, or blocks it, or completes it with the provided response bytes. If a network | |
/// fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted | |
/// event will be sent with the same InterceptionId. | |
/// Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn continue_intercepted_request(&mut self, req: network::ContinueInterceptedRequestRequest) -> Result<(), <Self as Network>::Error>; | |
/// Deletes browser cookies with matching name and url or domain/path pair. | |
fn delete_cookies(&mut self, name: String, url: Option<String>, domain: Option<String>, path: Option<String>) -> Result<(), <Self as Network>::Error>; | |
/// Disables network tracking, prevents network events from being sent to the client. | |
fn disable(&mut self) -> Result<(), <Self as Network>::Error>; | |
/// Activates emulation of network conditions. | |
fn emulate_network_conditions(&mut self, offline: Boolean, latency: Number, download_throughput: Number, upload_throughput: Number, connection_type: Option<network::ConnectionType>) -> Result<(), <Self as Network>::Error>; | |
/// Enables network tracking, network events will now be delivered to the client. | |
fn enable(&mut self, max_total_buffer_size: Option<Integer>, max_resource_buffer_size: Option<Integer>, max_post_data_size: Option<Integer>) -> Result<(), <Self as Network>::Error>; | |
/// Returns all browser cookies. Depending on the backend support, will return detailed cookie | |
/// information in the `cookies` field. | |
fn get_all_cookies(&mut self) -> Result<(Vec<network::Cookie>), <Self as Network>::Error>; | |
/// Returns the DER-encoded certificate. | |
#[cfg(feature = "experimental")] | |
fn get_certificate(&mut self, origin: String) -> Result<(Vec<String>), <Self as Network>::Error>; | |
/// Returns all browser cookies for the current URL. Depending on the backend support, will return | |
/// detailed cookie information in the `cookies` field. | |
fn get_cookies(&mut self, urls: Option<Vec<String>>) -> Result<(Vec<network::Cookie>), <Self as Network>::Error>; | |
/// Returns content served for the given request. | |
fn get_response_body(&mut self, request_id: network::RequestId) -> Result<(String, Boolean), <Self as Network>::Error>; | |
/// Returns post data sent with the request. Returns an error when no data was sent with the request. | |
fn get_request_post_data(&mut self, request_id: network::RequestId) -> Result<(String), <Self as Network>::Error>; | |
/// Returns content served for the given currently intercepted request. | |
#[cfg(feature = "experimental")] | |
fn get_response_body_for_interception(&mut self, interception_id: network::InterceptionId) -> Result<(String, Boolean), <Self as Network>::Error>; | |
/// Returns a handle to the stream representing the response body. Note that after this command, | |
/// the intercepted request can't be continued as is -- you either need to cancel it or to provide | |
/// the response body. The stream only supports sequential read, IO.read will fail if the position | |
/// is specified. | |
#[cfg(feature = "experimental")] | |
fn take_response_body_for_interception_as_stream(&mut self, interception_id: network::InterceptionId) -> Result<(io::StreamHandle), <Self as Network>::Error>; | |
/// This method sends a new XMLHttpRequest which is identical to the original one. The following | |
/// parameters should be identical: method, url, async, request body, extra headers, withCredentials | |
/// attribute, user, password. | |
#[cfg(feature = "experimental")] | |
fn replay_xhr(&mut self, request_id: network::RequestId) -> Result<(), <Self as Network>::Error>; | |
/// Searches for given string in response content. | |
#[cfg(feature = "experimental")] | |
fn search_in_response_body(&mut self, request_id: network::RequestId, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> Result<(Vec<debugger::SearchMatch>), <Self as Network>::Error>; | |
/// Blocks URLs from loading. | |
#[cfg(feature = "experimental")] | |
fn set_blocked_ur_ls(&mut self, urls: Vec<String>) -> Result<(), <Self as Network>::Error>; | |
/// Toggles ignoring of service worker for each request. | |
#[cfg(feature = "experimental")] | |
fn set_bypass_service_worker(&mut self, bypass: Boolean) -> Result<(), <Self as Network>::Error>; | |
/// Toggles ignoring cache for each request. If `true`, cache will not be used. | |
fn set_cache_disabled(&mut self, cache_disabled: Boolean) -> Result<(), <Self as Network>::Error>; | |
/// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. | |
fn set_cookie(&mut self, req: network::SetCookieRequest) -> Result<(Boolean), <Self as Network>::Error>; | |
/// Sets given cookies. | |
fn set_cookies(&mut self, cookies: Vec<network::CookieParam>) -> Result<(), <Self as Network>::Error>; | |
/// For testing. | |
#[cfg(feature = "experimental")] | |
fn set_data_size_limits_for_test(&mut self, max_total_size: Integer, max_resource_size: Integer) -> Result<(), <Self as Network>::Error>; | |
/// Specifies whether to always send extra HTTP headers with the requests from this page. | |
fn set_extra_http_headers(&mut self, headers: network::Headers) -> Result<(), <Self as Network>::Error>; | |
/// Sets the requests to intercept that match the provided patterns and optionally resource types. | |
/// Deprecated, please use Fetch.enable instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_request_interception(&mut self, patterns: Vec<network::RequestPattern>) -> Result<(), <Self as Network>::Error>; | |
/// Allows overriding user agent with the given string. | |
fn set_user_agent_override(&mut self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> Result<(), <Self as Network>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "network"))] | |
impl<T> Network for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn can_clear_browser_cache(&mut self) -> Result<(Boolean), <Self as Network>::Error> { | |
CallSite::call(self, network::CanClearBrowserCacheRequest {}).map(|res| (res.result)) | |
} | |
fn can_clear_browser_cookies(&mut self) -> Result<(Boolean), <Self as Network>::Error> { | |
CallSite::call(self, network::CanClearBrowserCookiesRequest {}).map(|res| (res.result)) | |
} | |
fn can_emulate_network_conditions(&mut self) -> Result<(Boolean), <Self as Network>::Error> { | |
CallSite::call(self, network::CanEmulateNetworkConditionsRequest {}).map(|res| (res.result)) | |
} | |
fn clear_browser_cache(&mut self) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::ClearBrowserCacheRequest {}).map(|_| ()) | |
} | |
fn clear_browser_cookies(&mut self) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::ClearBrowserCookiesRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn continue_intercepted_request(&mut self, req: network::ContinueInterceptedRequestRequest) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
fn delete_cookies(&mut self, name: String, url: Option<String>, domain: Option<String>, path: Option<String>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::DeleteCookiesRequest { name, url, domain, path }).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::DisableRequest {}).map(|_| ()) | |
} | |
fn emulate_network_conditions(&mut self, offline: Boolean, latency: Number, download_throughput: Number, upload_throughput: Number, connection_type: Option<network::ConnectionType>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::EmulateNetworkConditionsRequest { offline, latency, download_throughput, upload_throughput, connection_type }).map(|_| ()) | |
} | |
fn enable(&mut self, max_total_buffer_size: Option<Integer>, max_resource_buffer_size: Option<Integer>, max_post_data_size: Option<Integer>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::EnableRequest { max_total_buffer_size, max_resource_buffer_size, max_post_data_size }).map(|_| ()) | |
} | |
fn get_all_cookies(&mut self) -> Result<(Vec<network::Cookie>), <Self as Network>::Error> { | |
CallSite::call(self, network::GetAllCookiesRequest {}).map(|res| (res.cookies)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_certificate(&mut self, origin: String) -> Result<(Vec<String>), <Self as Network>::Error> { | |
CallSite::call(self, network::GetCertificateRequest { origin }).map(|res| (res.table_names)) | |
} | |
fn get_cookies(&mut self, urls: Option<Vec<String>>) -> Result<(Vec<network::Cookie>), <Self as Network>::Error> { | |
CallSite::call(self, network::GetCookiesRequest { urls }).map(|res| (res.cookies)) | |
} | |
fn get_response_body(&mut self, request_id: network::RequestId) -> Result<(String, Boolean), <Self as Network>::Error> { | |
CallSite::call(self, network::GetResponseBodyRequest { request_id }).map(|res| (res.body, res.base64_encoded)) | |
} | |
fn get_request_post_data(&mut self, request_id: network::RequestId) -> Result<(String), <Self as Network>::Error> { | |
CallSite::call(self, network::GetRequestPostDataRequest { request_id }).map(|res| (res.post_data)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_response_body_for_interception(&mut self, interception_id: network::InterceptionId) -> Result<(String, Boolean), <Self as Network>::Error> { | |
CallSite::call(self, network::GetResponseBodyForInterceptionRequest { interception_id }).map(|res| (res.body, res.base64_encoded)) | |
} | |
#[cfg(feature = "experimental")] | |
fn take_response_body_for_interception_as_stream(&mut self, interception_id: network::InterceptionId) -> Result<(io::StreamHandle), <Self as Network>::Error> { | |
CallSite::call(self, network::TakeResponseBodyForInterceptionAsStreamRequest { interception_id }).map(|res| (res.stream)) | |
} | |
#[cfg(feature = "experimental")] | |
fn replay_xhr(&mut self, request_id: network::RequestId) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::ReplayXHRRequest { request_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn search_in_response_body(&mut self, request_id: network::RequestId, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> Result<(Vec<debugger::SearchMatch>), <Self as Network>::Error> { | |
CallSite::call(self, network::SearchInResponseBodyRequest { request_id, query, case_sensitive, is_regex }).map(|res| (res.result)) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_blocked_ur_ls(&mut self, urls: Vec<String>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetBlockedURLsRequest { urls }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_bypass_service_worker(&mut self, bypass: Boolean) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetBypassServiceWorkerRequest { bypass }).map(|_| ()) | |
} | |
fn set_cache_disabled(&mut self, cache_disabled: Boolean) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetCacheDisabledRequest { cache_disabled }).map(|_| ()) | |
} | |
fn set_cookie(&mut self, req: network::SetCookieRequest) -> Result<(Boolean), <Self as Network>::Error> { | |
CallSite::call(self, req).map(|res| (res.success)) | |
} | |
fn set_cookies(&mut self, cookies: Vec<network::CookieParam>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetCookiesRequest { cookies }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_data_size_limits_for_test(&mut self, max_total_size: Integer, max_resource_size: Integer) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetDataSizeLimitsForTestRequest { max_total_size, max_resource_size }).map(|_| ()) | |
} | |
fn set_extra_http_headers(&mut self, headers: network::Headers) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetExtraHTTPHeadersRequest { headers }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_request_interception(&mut self, patterns: Vec<network::RequestPattern>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetRequestInterceptionRequest { patterns }).map(|_| ()) | |
} | |
fn set_user_agent_override(&mut self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> Result<(), <Self as Network>::Error> { | |
CallSite::call(self, network::SetUserAgentOverrideRequest { user_agent, accept_language, platform }).map(|_| ()) | |
} | |
} | |
/// Network domain allows tracking network activities of the page. It exposes information about http, | |
/// file, data and other requests and responses, their headers, bodies, timing, etc. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "network")))] | |
pub trait AsyncNetwork: AsyncDebugger + AsyncRuntime + AsyncSecurity where Self: Sized { | |
type Error; | |
type CanClearBrowserCache: futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
type CanClearBrowserCookies: futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
type CanEmulateNetworkConditions: futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
type ClearBrowserCache: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type ClearBrowserCookies: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type ContinueInterceptedRequest: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type DeleteCookies: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type EmulateNetworkConditions: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type GetAllCookies: futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetCertificate: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncNetwork>::Error>; | |
type GetCookies: futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncNetwork>::Error>; | |
type GetResponseBody: futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
type GetRequestPostData: futures::Future<Item = ((String), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetResponseBodyForInterception: futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type TakeResponseBodyForInterceptionAsStream: futures::Future<Item = ((io::StreamHandle), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type ReplayXHR: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type SearchInResponseBody: futures::Future<Item = ((Vec<debugger::SearchMatch>), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetBlockedURLs: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetBypassServiceWorker: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type SetCacheDisabled: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type SetCookie: futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncNetwork>::Error>; | |
type SetCookies: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDataSizeLimitsForTest: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type SetExtraHTTPHeaders: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetRequestInterception: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
type SetUserAgentOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncNetwork>::Error>; | |
/// Tells whether clearing browser cache is supported. | |
#[deprecated] | |
fn can_clear_browser_cache(self) -> <Self as AsyncNetwork>::CanClearBrowserCache; | |
/// Tells whether clearing browser cookies is supported. | |
#[deprecated] | |
fn can_clear_browser_cookies(self) -> <Self as AsyncNetwork>::CanClearBrowserCookies; | |
/// Tells whether emulation of network conditions is supported. | |
#[deprecated] | |
fn can_emulate_network_conditions(self) -> <Self as AsyncNetwork>::CanEmulateNetworkConditions; | |
/// Clears browser cache. | |
fn clear_browser_cache(self) -> <Self as AsyncNetwork>::ClearBrowserCache; | |
/// Clears browser cookies. | |
fn clear_browser_cookies(self) -> <Self as AsyncNetwork>::ClearBrowserCookies; | |
/// Response to Network.requestIntercepted which either modifies the request to continue with any | |
/// modifications, or blocks it, or completes it with the provided response bytes. If a network | |
/// fetch occurs as a result which encounters a redirect an additional Network.requestIntercepted | |
/// event will be sent with the same InterceptionId. | |
/// Deprecated, use Fetch.continueRequest, Fetch.fulfillRequest and Fetch.failRequest instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn continue_intercepted_request(self, req: network::ContinueInterceptedRequestRequest) -> <Self as AsyncNetwork>::ContinueInterceptedRequest; | |
/// Deletes browser cookies with matching name and url or domain/path pair. | |
fn delete_cookies(self, name: String, url: Option<String>, domain: Option<String>, path: Option<String>) -> <Self as AsyncNetwork>::DeleteCookies; | |
/// Disables network tracking, prevents network events from being sent to the client. | |
fn disable(self) -> <Self as AsyncNetwork>::Disable; | |
/// Activates emulation of network conditions. | |
fn emulate_network_conditions(self, offline: Boolean, latency: Number, download_throughput: Number, upload_throughput: Number, connection_type: Option<network::ConnectionType>) -> <Self as AsyncNetwork>::EmulateNetworkConditions; | |
/// Enables network tracking, network events will now be delivered to the client. | |
fn enable(self, max_total_buffer_size: Option<Integer>, max_resource_buffer_size: Option<Integer>, max_post_data_size: Option<Integer>) -> <Self as AsyncNetwork>::Enable; | |
/// Returns all browser cookies. Depending on the backend support, will return detailed cookie | |
/// information in the `cookies` field. | |
fn get_all_cookies(self) -> <Self as AsyncNetwork>::GetAllCookies; | |
/// Returns the DER-encoded certificate. | |
#[cfg(feature = "experimental")] | |
fn get_certificate(self, origin: String) -> <Self as AsyncNetwork>::GetCertificate; | |
/// Returns all browser cookies for the current URL. Depending on the backend support, will return | |
/// detailed cookie information in the `cookies` field. | |
fn get_cookies(self, urls: Option<Vec<String>>) -> <Self as AsyncNetwork>::GetCookies; | |
/// Returns content served for the given request. | |
fn get_response_body(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::GetResponseBody; | |
/// Returns post data sent with the request. Returns an error when no data was sent with the request. | |
fn get_request_post_data(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::GetRequestPostData; | |
/// Returns content served for the given currently intercepted request. | |
#[cfg(feature = "experimental")] | |
fn get_response_body_for_interception(self, interception_id: network::InterceptionId) -> <Self as AsyncNetwork>::GetResponseBodyForInterception; | |
/// Returns a handle to the stream representing the response body. Note that after this command, | |
/// the intercepted request can't be continued as is -- you either need to cancel it or to provide | |
/// the response body. The stream only supports sequential read, IO.read will fail if the position | |
/// is specified. | |
#[cfg(feature = "experimental")] | |
fn take_response_body_for_interception_as_stream(self, interception_id: network::InterceptionId) -> <Self as AsyncNetwork>::TakeResponseBodyForInterceptionAsStream; | |
/// This method sends a new XMLHttpRequest which is identical to the original one. The following | |
/// parameters should be identical: method, url, async, request body, extra headers, withCredentials | |
/// attribute, user, password. | |
#[cfg(feature = "experimental")] | |
fn replay_xhr(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::ReplayXHR; | |
/// Searches for given string in response content. | |
#[cfg(feature = "experimental")] | |
fn search_in_response_body(self, request_id: network::RequestId, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> <Self as AsyncNetwork>::SearchInResponseBody; | |
/// Blocks URLs from loading. | |
#[cfg(feature = "experimental")] | |
fn set_blocked_ur_ls(self, urls: Vec<String>) -> <Self as AsyncNetwork>::SetBlockedURLs; | |
/// Toggles ignoring of service worker for each request. | |
#[cfg(feature = "experimental")] | |
fn set_bypass_service_worker(self, bypass: Boolean) -> <Self as AsyncNetwork>::SetBypassServiceWorker; | |
/// Toggles ignoring cache for each request. If `true`, cache will not be used. | |
fn set_cache_disabled(self, cache_disabled: Boolean) -> <Self as AsyncNetwork>::SetCacheDisabled; | |
/// Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist. | |
fn set_cookie(self, req: network::SetCookieRequest) -> <Self as AsyncNetwork>::SetCookie; | |
/// Sets given cookies. | |
fn set_cookies(self, cookies: Vec<network::CookieParam>) -> <Self as AsyncNetwork>::SetCookies; | |
/// For testing. | |
#[cfg(feature = "experimental")] | |
fn set_data_size_limits_for_test(self, max_total_size: Integer, max_resource_size: Integer) -> <Self as AsyncNetwork>::SetDataSizeLimitsForTest; | |
/// Specifies whether to always send extra HTTP headers with the requests from this page. | |
fn set_extra_http_headers(self, headers: network::Headers) -> <Self as AsyncNetwork>::SetExtraHTTPHeaders; | |
/// Sets the requests to intercept that match the provided patterns and optionally resource types. | |
/// Deprecated, please use Fetch.enable instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_request_interception(self, patterns: Vec<network::RequestPattern>) -> <Self as AsyncNetwork>::SetRequestInterception; | |
/// Allows overriding user agent with the given string. | |
fn set_user_agent_override(self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> <Self as AsyncNetwork>::SetUserAgentOverride; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "network")))] | |
impl<T> AsyncNetwork for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type CanClearBrowserCache = Box<dyn futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CanClearBrowserCookies = Box<dyn futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CanEmulateNetworkConditions = Box<dyn futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearBrowserCache = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearBrowserCookies = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ContinueInterceptedRequest = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type DeleteCookies = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type EmulateNetworkConditions = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetAllCookies = Box<dyn futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetCertificate = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetCookies = Box<dyn futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetResponseBody = Box<dyn futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetRequestPostData = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetResponseBodyForInterception = Box<dyn futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type TakeResponseBodyForInterceptionAsStream = Box<dyn futures::Future<Item = ((io::StreamHandle), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ReplayXHR = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SearchInResponseBody = Box<dyn futures::Future<Item = ((Vec<debugger::SearchMatch>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetBlockedURLs = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetBypassServiceWorker = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetCacheDisabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetCookie = Box<dyn futures::Future<Item = ((Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetCookies = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDataSizeLimitsForTest = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetExtraHTTPHeaders = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetRequestInterception = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetUserAgentOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn can_clear_browser_cache(self) -> <Self as AsyncNetwork>::CanClearBrowserCache { | |
Box::new(AsyncCallSite::async_call(self, network::CanClearBrowserCacheRequest {}).map(|(res, self_)| ((res.result), self_))) | |
} | |
fn can_clear_browser_cookies(self) -> <Self as AsyncNetwork>::CanClearBrowserCookies { | |
Box::new(AsyncCallSite::async_call(self, network::CanClearBrowserCookiesRequest {}).map(|(res, self_)| ((res.result), self_))) | |
} | |
fn can_emulate_network_conditions(self) -> <Self as AsyncNetwork>::CanEmulateNetworkConditions { | |
Box::new(AsyncCallSite::async_call(self, network::CanEmulateNetworkConditionsRequest {}).map(|(res, self_)| ((res.result), self_))) | |
} | |
fn clear_browser_cache(self) -> <Self as AsyncNetwork>::ClearBrowserCache { | |
Box::new(AsyncCallSite::async_call(self, network::ClearBrowserCacheRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn clear_browser_cookies(self) -> <Self as AsyncNetwork>::ClearBrowserCookies { | |
Box::new(AsyncCallSite::async_call(self, network::ClearBrowserCookiesRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn continue_intercepted_request(self, req: network::ContinueInterceptedRequestRequest) -> <Self as AsyncNetwork>::ContinueInterceptedRequest { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
fn delete_cookies(self, name: String, url: Option<String>, domain: Option<String>, path: Option<String>) -> <Self as AsyncNetwork>::DeleteCookies { | |
Box::new(AsyncCallSite::async_call(self, network::DeleteCookiesRequest { name, url, domain, path }).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncNetwork>::Disable { | |
Box::new(AsyncCallSite::async_call(self, network::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn emulate_network_conditions(self, offline: Boolean, latency: Number, download_throughput: Number, upload_throughput: Number, connection_type: Option<network::ConnectionType>) -> <Self as AsyncNetwork>::EmulateNetworkConditions { | |
Box::new(AsyncCallSite::async_call(self, network::EmulateNetworkConditionsRequest { offline, latency, download_throughput, upload_throughput, connection_type }).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self, max_total_buffer_size: Option<Integer>, max_resource_buffer_size: Option<Integer>, max_post_data_size: Option<Integer>) -> <Self as AsyncNetwork>::Enable { | |
Box::new(AsyncCallSite::async_call(self, network::EnableRequest { max_total_buffer_size, max_resource_buffer_size, max_post_data_size }).map(|(_, self_)| ((), self_))) | |
} | |
fn get_all_cookies(self) -> <Self as AsyncNetwork>::GetAllCookies { | |
Box::new(AsyncCallSite::async_call(self, network::GetAllCookiesRequest {}).map(|(res, self_)| ((res.cookies), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_certificate(self, origin: String) -> <Self as AsyncNetwork>::GetCertificate { | |
Box::new(AsyncCallSite::async_call(self, network::GetCertificateRequest { origin }).map(|(res, self_)| ((res.table_names), self_))) | |
} | |
fn get_cookies(self, urls: Option<Vec<String>>) -> <Self as AsyncNetwork>::GetCookies { | |
Box::new(AsyncCallSite::async_call(self, network::GetCookiesRequest { urls }).map(|(res, self_)| ((res.cookies), self_))) | |
} | |
fn get_response_body(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::GetResponseBody { | |
Box::new(AsyncCallSite::async_call(self, network::GetResponseBodyRequest { request_id }).map(|(res, self_)| ((res.body, res.base64_encoded), self_))) | |
} | |
fn get_request_post_data(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::GetRequestPostData { | |
Box::new(AsyncCallSite::async_call(self, network::GetRequestPostDataRequest { request_id }).map(|(res, self_)| ((res.post_data), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_response_body_for_interception(self, interception_id: network::InterceptionId) -> <Self as AsyncNetwork>::GetResponseBodyForInterception { | |
Box::new(AsyncCallSite::async_call(self, network::GetResponseBodyForInterceptionRequest { interception_id }).map(|(res, self_)| ((res.body, res.base64_encoded), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn take_response_body_for_interception_as_stream(self, interception_id: network::InterceptionId) -> <Self as AsyncNetwork>::TakeResponseBodyForInterceptionAsStream { | |
Box::new(AsyncCallSite::async_call(self, network::TakeResponseBodyForInterceptionAsStreamRequest { interception_id }).map(|(res, self_)| ((res.stream), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn replay_xhr(self, request_id: network::RequestId) -> <Self as AsyncNetwork>::ReplayXHR { | |
Box::new(AsyncCallSite::async_call(self, network::ReplayXHRRequest { request_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn search_in_response_body(self, request_id: network::RequestId, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> <Self as AsyncNetwork>::SearchInResponseBody { | |
Box::new(AsyncCallSite::async_call(self, network::SearchInResponseBodyRequest { request_id, query, case_sensitive, is_regex }).map(|(res, self_)| ((res.result), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_blocked_ur_ls(self, urls: Vec<String>) -> <Self as AsyncNetwork>::SetBlockedURLs { | |
Box::new(AsyncCallSite::async_call(self, network::SetBlockedURLsRequest { urls }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_bypass_service_worker(self, bypass: Boolean) -> <Self as AsyncNetwork>::SetBypassServiceWorker { | |
Box::new(AsyncCallSite::async_call(self, network::SetBypassServiceWorkerRequest { bypass }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_cache_disabled(self, cache_disabled: Boolean) -> <Self as AsyncNetwork>::SetCacheDisabled { | |
Box::new(AsyncCallSite::async_call(self, network::SetCacheDisabledRequest { cache_disabled }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_cookie(self, req: network::SetCookieRequest) -> <Self as AsyncNetwork>::SetCookie { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(res, self_)| ((res.success), self_))) | |
} | |
fn set_cookies(self, cookies: Vec<network::CookieParam>) -> <Self as AsyncNetwork>::SetCookies { | |
Box::new(AsyncCallSite::async_call(self, network::SetCookiesRequest { cookies }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_data_size_limits_for_test(self, max_total_size: Integer, max_resource_size: Integer) -> <Self as AsyncNetwork>::SetDataSizeLimitsForTest { | |
Box::new(AsyncCallSite::async_call(self, network::SetDataSizeLimitsForTestRequest { max_total_size, max_resource_size }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_extra_http_headers(self, headers: network::Headers) -> <Self as AsyncNetwork>::SetExtraHTTPHeaders { | |
Box::new(AsyncCallSite::async_call(self, network::SetExtraHTTPHeadersRequest { headers }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_request_interception(self, patterns: Vec<network::RequestPattern>) -> <Self as AsyncNetwork>::SetRequestInterception { | |
Box::new(AsyncCallSite::async_call(self, network::SetRequestInterceptionRequest { patterns }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_user_agent_override(self, user_agent: String, accept_language: Option<String>, platform: Option<String>) -> <Self as AsyncNetwork>::SetUserAgentOverride { | |
Box::new(AsyncCallSite::async_call(self, network::SetUserAgentOverrideRequest { user_agent, accept_language, platform }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// Network domain allows tracking network activities of the page. It exposes information about http, | |
/// file, data and other requests and responses, their headers, bodies, timing, etc. | |
#[cfg(any(feature = "all", feature = "network"))] | |
#[allow(deprecated)] | |
pub mod network { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Resource type as it was perceived by the rendering engine. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ResourceType { | |
Document, | |
Stylesheet, | |
Image, | |
Media, | |
Font, | |
Script, | |
TextTrack, | |
XHR, | |
Fetch, | |
EventSource, | |
WebSocket, | |
Manifest, | |
SignedExchange, | |
Ping, | |
CSPViolationReport, | |
Other, | |
} | |
/// Unique loader identifier. | |
pub type LoaderId = String; | |
/// Unique request identifier. | |
pub type RequestId = String; | |
/// Unique intercepted request identifier. | |
pub type InterceptionId = String; | |
/// Network level fetch failure reason. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ErrorReason { | |
Failed, | |
Aborted, | |
TimedOut, | |
AccessDenied, | |
ConnectionClosed, | |
ConnectionReset, | |
ConnectionRefused, | |
ConnectionAborted, | |
ConnectionFailed, | |
NameNotResolved, | |
InternetDisconnected, | |
AddressUnreachable, | |
BlockedByClient, | |
BlockedByResponse, | |
} | |
/// UTC time in seconds, counted from January 1, 1970. | |
pub type TimeSinceEpoch = Number; | |
/// Monotonically increasing time in seconds since an arbitrary point in the past. | |
pub type MonotonicTime = Number; | |
/// Request / response headers as keys / values of JSON object. | |
pub type Headers = Object; | |
/// The underlying connection technology that the browser is supposedly using. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ConnectionType { | |
None, | |
Cellular2g, | |
Cellular3g, | |
Cellular4g, | |
Bluetooth, | |
Ethernet, | |
Wifi, | |
Wimax, | |
Other, | |
} | |
/// Represents the cookie's 'SameSite' status: | |
/// https://tools.ietf.org/html/draft-west-first-party-cookies | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CookieSameSite { | |
Strict, | |
Lax, | |
Extended, | |
None, | |
} | |
/// Timing information for the request. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResourceTiming { | |
/// Timing's requestTime is a baseline in seconds, while the other numbers are ticks in | |
/// milliseconds relatively to this requestTime. | |
pub request_time: Number, | |
/// Started resolving proxy. | |
pub proxy_start: Number, | |
/// Finished resolving proxy. | |
pub proxy_end: Number, | |
/// Started DNS address resolve. | |
pub dns_start: Number, | |
/// Finished DNS address resolve. | |
pub dns_end: Number, | |
/// Started connecting to the remote host. | |
pub connect_start: Number, | |
/// Connected to the remote host. | |
pub connect_end: Number, | |
/// Started SSL handshake. | |
pub ssl_start: Number, | |
/// Finished SSL handshake. | |
pub ssl_end: Number, | |
/// Started running ServiceWorker. | |
#[cfg(feature = "experimental")] | |
pub worker_start: Number, | |
/// Finished Starting ServiceWorker. | |
#[cfg(feature = "experimental")] | |
pub worker_ready: Number, | |
/// Started sending request. | |
pub send_start: Number, | |
/// Finished sending request. | |
pub send_end: Number, | |
/// Time the server started pushing request. | |
#[cfg(feature = "experimental")] | |
pub push_start: Number, | |
/// Time the server finished pushing request. | |
#[cfg(feature = "experimental")] | |
pub push_end: Number, | |
/// Finished receiving response headers. | |
pub receive_headers_end: Number, | |
} | |
/// Loading priority of a resource request. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ResourcePriority { | |
VeryLow, | |
Low, | |
Medium, | |
High, | |
VeryHigh, | |
} | |
/// HTTP request data. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Request { | |
/// Request URL (without fragment). | |
pub url: String, | |
/// Fragment of the requested URL starting with hash, if present. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url_fragment: Option<String>, | |
/// HTTP request method. | |
pub method: String, | |
/// HTTP request headers. | |
pub headers: Headers, | |
/// HTTP POST request data. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub post_data: Option<String>, | |
/// True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub has_post_data: Option<Boolean>, | |
/// The mixed content type of the request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub mixed_content_type: Option<security::MixedContentType>, | |
/// Priority of the resource request at the time request is sent. | |
pub initial_priority: ResourcePriority, | |
/// The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ | |
pub referrer_policy: RequestReferrerPolicy, | |
/// Whether is loaded via link preload. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_link_preload: Option<Boolean>, | |
} | |
/// Allow values for the `Request::referrerPolicy` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum RequestReferrerPolicy { | |
UnsafeUrl, | |
NoReferrerWhenDowngrade, | |
NoReferrer, | |
Origin, | |
OriginWhenCrossOrigin, | |
SameOrigin, | |
StrictOrigin, | |
StrictOriginWhenCrossOrigin, | |
} | |
/// Details of a signed certificate timestamp (SCT). | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedCertificateTimestamp { | |
/// Validation status. | |
pub status: String, | |
/// Origin. | |
pub origin: String, | |
/// Log name / description. | |
pub log_description: String, | |
/// Log ID. | |
pub log_id: String, | |
/// Issuance date. | |
pub timestamp: TimeSinceEpoch, | |
/// Hash algorithm. | |
pub hash_algorithm: String, | |
/// Signature algorithm. | |
pub signature_algorithm: String, | |
/// Signature data. | |
pub signature_data: String, | |
} | |
/// Security details about a request. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SecurityDetails { | |
/// Protocol name (e.g. "TLS 1.2" or "QUIC"). | |
pub protocol: String, | |
/// Key Exchange used by the connection, or the empty string if not applicable. | |
pub key_exchange: String, | |
/// (EC)DH group used by the connection, if applicable. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub key_exchange_group: Option<String>, | |
/// Cipher name. | |
pub cipher: String, | |
/// TLS MAC. Note that AEAD ciphers do not have separate MACs. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub mac: Option<String>, | |
/// Certificate ID value. | |
pub certificate_id: security::CertificateId, | |
/// Certificate subject name. | |
pub subject_name: String, | |
/// Subject Alternative Name (SAN) DNS names and IP addresses. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub san_list: Vec<String>, | |
/// Name of the issuing CA. | |
pub issuer: String, | |
/// Certificate valid from date. | |
pub valid_from: TimeSinceEpoch, | |
/// Certificate valid to (expiration) date | |
pub valid_to: TimeSinceEpoch, | |
/// List of signed certificate timestamps (SCTs). | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub signed_certificate_timestamp_list: Vec<SignedCertificateTimestamp>, | |
/// Whether the request complied with Certificate Transparency policy | |
pub certificate_transparency_compliance: CertificateTransparencyCompliance, | |
} | |
/// Whether the request complied with Certificate Transparency policy. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CertificateTransparencyCompliance { | |
Unknown, | |
NotCompliant, | |
Compliant, | |
} | |
/// The reason why request was blocked. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum BlockedReason { | |
Other, | |
Csp, | |
MixedContent, | |
Origin, | |
Inspector, | |
SubresourceFilter, | |
ContentType, | |
CollapsedByClient, | |
} | |
/// HTTP response data. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Response { | |
/// Response URL. This URL can be different from CachedResource.url in case of redirect. | |
pub url: String, | |
/// HTTP response status code. | |
pub status: Integer, | |
/// HTTP response status text. | |
pub status_text: String, | |
/// HTTP response headers. | |
pub headers: Headers, | |
/// HTTP response headers text. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub headers_text: Option<String>, | |
/// Resource mimeType as determined by the browser. | |
pub mime_type: String, | |
/// Refined HTTP request headers that were actually transmitted over the network. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub request_headers: Option<Headers>, | |
/// HTTP request headers text. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub request_headers_text: Option<String>, | |
/// Specifies whether physical connection was actually reused for this request. | |
pub connection_reused: Boolean, | |
/// Physical connection id that was actually used for this request. | |
pub connection_id: Number, | |
/// Remote IP address. | |
#[serde(rename = "remoteIPAddress")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub remote_ip_address: Option<String>, | |
/// Remote port. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub remote_port: Option<Integer>, | |
/// Specifies that the request was served from the disk cache. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub from_disk_cache: Option<Boolean>, | |
/// Specifies that the request was served from the ServiceWorker. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub from_service_worker: Option<Boolean>, | |
/// Specifies that the request was served from the prefetch cache. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub from_prefetch_cache: Option<Boolean>, | |
/// Total number of bytes received for this request so far. | |
pub encoded_data_length: Number, | |
/// Timing information for the given request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timing: Option<ResourceTiming>, | |
/// Protocol used to fetch this request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub protocol: Option<String>, | |
/// Security state of the request resource. | |
pub security_state: security::SecurityState, | |
/// Security details for the request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub security_details: Option<SecurityDetails>, | |
} | |
/// WebSocket request data. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketRequest { | |
/// HTTP request headers. | |
pub headers: Headers, | |
} | |
/// WebSocket response data. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketResponse { | |
/// HTTP response status code. | |
pub status: Integer, | |
/// HTTP response status text. | |
pub status_text: String, | |
/// HTTP response headers. | |
pub headers: Headers, | |
/// HTTP response headers text. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub headers_text: Option<String>, | |
/// HTTP request headers. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub request_headers: Option<Headers>, | |
/// HTTP request headers text. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub request_headers_text: Option<String>, | |
} | |
/// WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketFrame { | |
/// WebSocket message opcode. | |
pub opcode: Number, | |
/// WebSocket message mask. | |
pub mask: Boolean, | |
/// WebSocket message payload data. | |
/// If the opcode is 1, this is a text message and payloadData is a UTF-8 string. | |
/// If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. | |
pub payload_data: String, | |
} | |
/// Information about the cached resource. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CachedResource { | |
/// Resource URL. This is the url of the original network request. | |
pub url: String, | |
/// Type of this resource. | |
#[serde(rename = "type")] | |
pub r#type: ResourceType, | |
/// Cached response data. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub response: Option<Response>, | |
/// Cached response body size. | |
pub body_size: Number, | |
} | |
/// Information about the request initiator. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Initiator { | |
/// Type of this initiator. | |
#[serde(rename = "type")] | |
pub r#type: InitiatorType, | |
/// Initiator JavaScript stack trace, set for Script only. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub stack: Option<runtime::StackTrace>, | |
/// Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// Initiator line number, set for Parser type or for Script type (when script is importing | |
/// module) (0-based). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub line_number: Option<Number>, | |
} | |
/// Allow values for the `Initiator::type` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum InitiatorType { | |
Parser, | |
Script, | |
Preload, | |
SignedExchange, | |
Other, | |
} | |
/// Cookie object | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Cookie { | |
/// Cookie name. | |
pub name: String, | |
/// Cookie value. | |
pub value: String, | |
/// Cookie domain. | |
pub domain: String, | |
/// Cookie path. | |
pub path: String, | |
/// Cookie expiration date as the number of seconds since the UNIX epoch. | |
pub expires: Number, | |
/// Cookie size. | |
pub size: Integer, | |
/// True if cookie is http-only. | |
pub http_only: Boolean, | |
/// True if cookie is secure. | |
pub secure: Boolean, | |
/// True in case of session cookie. | |
pub session: Boolean, | |
/// Cookie SameSite type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub same_site: Option<CookieSameSite>, | |
} | |
/// Types of reasons why a cookie may not be stored from a response. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum SetCookieBlockedReason { | |
/// The cookie had the "Secure" attribute but was not received over a secure connection. | |
SecureOnly, | |
/// The cookie had the "SameSite=Strict" attribute but came from a cross-origin response. | |
/// This includes navigation requests intitiated by other origins. | |
SameSiteStrict, | |
/// The cookie had the "SameSite=Lax" attribute but came from a cross-origin response. | |
SameSiteLax, | |
/// The cookie had the "SameSite=Extended" attribute but came from a cross-origin response. | |
SameSiteExtended, | |
/// The cookie didn't specify a "SameSite" attribute and was defaulted to "SameSite=Lax" and | |
/// broke the same rules specified in the SameSiteLax value. | |
SameSiteUnspecifiedTreatedAsLax, | |
/// The cookie had the "SameSite=None" attribute but did not specify the "Secure" attribute, | |
/// which is required in order to use "SameSite=None". | |
SameSiteNoneInsecure, | |
/// The cookie was not stored due to user preferences. | |
UserPreferences, | |
/// The syntax of the Set-Cookie header of the response was invalid. | |
SyntaxError, | |
/// The scheme of the connection is not allowed to store cookies. | |
SchemeNotSupported, | |
/// The cookie was not sent over a secure connection and would have overwritten a cookie with | |
/// the Secure attribute. | |
OverwriteSecure, | |
/// The cookie's domain attribute was invalid with regards to the current host url. | |
InvalidDomain, | |
/// The cookie used the "__Secure-" or "__Host-" prefix in its name and broke the additional | |
/// rules applied to cookies with these prefixes as defined in | |
/// https://tools.ietf.org/html/draft-west-cookie-prefixes-05 | |
InvalidPrefix, | |
/// An unknown error was encountered when trying to store this cookie. | |
UnknownError, | |
} | |
/// Types of reasons why a cookie may not be sent with a request. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CookieBlockedReason { | |
/// The cookie had the "Secure" attribute and the connection was not secure. | |
SecureOnly, | |
/// The cookie's path was not within the request url's path. | |
NotOnPath, | |
/// The cookie's domain is not configured to match the request url's domain, even though they | |
/// share a common TLD+1 (TLD+1 of foo.bar.example.com is example.com). | |
DomainMismatch, | |
/// The cookie had the "SameSite=Strict" attribute and the request was made on on a different | |
/// site. This includes navigation requests initiated by other sites. | |
SameSiteStrict, | |
/// The cookie had the "SameSite=Lax" attribute and the request was made on a different site. | |
/// This does not include navigation requests initiated by other sites. | |
SameSiteLax, | |
/// The cookie had the "SameSite=Extended" attribute and the request was made on a different | |
/// site. The different site is outside of the cookie's trusted first-party set. | |
SameSiteExtended, | |
/// The cookie didn't specify a SameSite attribute when it was stored and was defaulted to | |
/// "SameSite=Lax" and broke the same rules specified in the SameSiteLax value. The cookie had | |
/// to have been set with "SameSite=None" to enable third-party usage. | |
SameSiteUnspecifiedTreatedAsLax, | |
/// The cookie had the "SameSite=None" attribute and the connection was not secure. Cookies | |
/// without SameSite restrictions must be sent over a secure connection. | |
SameSiteNoneInsecure, | |
/// The cookie was not sent due to user preferences. | |
UserPreferences, | |
/// An unknown error was encountered when trying to send this cookie. | |
UnknownError, | |
} | |
/// A cookie which was not stored from a response with the corresponding reason. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BlockedSetCookieWithReason { | |
/// The reason this cookie was blocked. | |
pub blocked_reason: SetCookieBlockedReason, | |
/// The string representing this individual cookie as it would appear in the header. | |
/// This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. | |
pub cookie_line: String, | |
/// The cookie object which represents the cookie which was not stored. It is optional because | |
/// sometimes complete cookie information is not available, such as in the case of parsing | |
/// errors. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub cookie: Option<Cookie>, | |
} | |
/// A cookie with was not sent with a request with the corresponding reason. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BlockedCookieWithReason { | |
/// The reason the cookie was blocked. | |
pub blocked_reason: CookieBlockedReason, | |
/// The cookie object representing the cookie which was not sent. | |
pub cookie: Cookie, | |
} | |
/// Cookie parameter object | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CookieParam { | |
/// Cookie name. | |
pub name: String, | |
/// Cookie value. | |
pub value: String, | |
/// The request-URI to associate with the setting of the cookie. This value can affect the | |
/// default domain and path values of the created cookie. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// Cookie domain. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub domain: Option<String>, | |
/// Cookie path. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub path: Option<String>, | |
/// True if cookie is secure. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub secure: Option<Boolean>, | |
/// True if cookie is http-only. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub http_only: Option<Boolean>, | |
/// Cookie SameSite type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub same_site: Option<CookieSameSite>, | |
/// Cookie expiration date, session cookie if not set | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub expires: Option<TimeSinceEpoch>, | |
} | |
/// Authorization challenge for HTTP status code 401 or 407. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AuthChallenge { | |
/// Source of the authentication challenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub source: Option<AuthChallengeSource>, | |
/// Origin of the challenger. | |
pub origin: String, | |
/// The authentication scheme used, such as basic or digest | |
pub scheme: String, | |
/// The realm of the challenge. May be empty. | |
pub realm: String, | |
} | |
/// Allow values for the `AuthChallenge::source` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AuthChallengeSource { | |
Server, | |
Proxy, | |
} | |
/// Response to an AuthChallenge. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AuthChallengeResponse { | |
/// The decision on what to do in response to the authorization challenge. Default means | |
/// deferring to the default behavior of the net stack, which will likely either the Cancel | |
/// authentication or display a popup dialog box. | |
pub response: AuthChallengeResponseResponse, | |
/// The username to provide, possibly empty. Should only be set if response is | |
/// ProvideCredentials. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub username: Option<String>, | |
/// The password to provide, possibly empty. Should only be set if response is | |
/// ProvideCredentials. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub password: Option<String>, | |
} | |
/// Allow values for the `AuthChallengeResponse::response` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum AuthChallengeResponseResponse { | |
Default, | |
CancelAuth, | |
ProvideCredentials, | |
} | |
/// Stages of the interception to begin intercepting. Request will intercept before the request is | |
/// sent. Response will intercept after the response is received. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum InterceptionStage { | |
Request, | |
HeadersReceived, | |
} | |
/// Request pattern for interception. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestPattern { | |
/// Wildcards ('*' -> zero or more, '?' -> exactly one) are allowed. Escape character is | |
/// backslash. Omitting is equivalent to "*". | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url_pattern: Option<String>, | |
/// If set, only requests for matching resource types will be intercepted. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub resource_type: Option<ResourceType>, | |
/// Stage at wich to begin intercepting requests. Default is Request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub interception_stage: Option<InterceptionStage>, | |
} | |
/// Information about a signed exchange signature. | |
/// https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedExchangeSignature { | |
/// Signed exchange signature label. | |
pub label: String, | |
/// The hex string of signed exchange signature. | |
pub signature: String, | |
/// Signed exchange signature integrity. | |
pub integrity: String, | |
/// Signed exchange signature cert Url. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub cert_url: Option<String>, | |
/// The hex string of signed exchange signature cert sha256. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub cert_sha256: Option<String>, | |
/// Signed exchange signature validity Url. | |
pub validity_url: String, | |
/// Signed exchange signature date. | |
pub date: Integer, | |
/// Signed exchange signature expires. | |
pub expires: Integer, | |
/// The encoded certificates. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub certificates: Option<Vec<String>>, | |
} | |
/// Information about a signed exchange header. | |
/// https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedExchangeHeader { | |
/// Signed exchange request URL. | |
pub request_url: String, | |
/// Signed exchange response code. | |
pub response_code: Integer, | |
/// Signed exchange response headers. | |
pub response_headers: Headers, | |
/// Signed exchange response signature. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub signatures: Vec<SignedExchangeSignature>, | |
/// Signed exchange header integrity hash in the form of "sha256-<base64-hash-value>". | |
pub header_integrity: String, | |
} | |
/// Field type for a signed exchange related error. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum SignedExchangeErrorField { | |
SignatureSig, | |
SignatureIntegrity, | |
SignatureCertUrl, | |
SignatureCertSha256, | |
SignatureValidityUrl, | |
SignatureTimestamps, | |
} | |
/// Information about a signed exchange response. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedExchangeError { | |
/// Error message. | |
pub message: String, | |
/// The index of the signature which caused the error. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub signature_index: Option<Integer>, | |
/// The field which caused the error. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub error_field: Option<SignedExchangeErrorField>, | |
} | |
/// Information about a signed exchange response. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedExchangeInfo { | |
/// The outer response of signed HTTP exchange which was received from network. | |
pub outer_response: Response, | |
/// Information about the signed exchange header. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub header: Option<SignedExchangeHeader>, | |
/// Security details for the signed exchange header. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub security_details: Option<SecurityDetails>, | |
/// Errors occurred while handling the signed exchagne. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub errors: Option<Vec<SignedExchangeError>>, | |
} | |
/// Method parameters of the `Network::canClearBrowserCache` command. | |
#[deprecated] | |
pub type CanClearBrowserCache = CanClearBrowserCacheRequest; | |
/// Return object of the `Network::canClearBrowserCache` command. | |
#[deprecated] | |
pub type CanClearBrowserCacheReturnObject = CanClearBrowserCacheResponse; | |
/// Request object of the `Network::canClearBrowserCache` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanClearBrowserCacheRequest { | |
} | |
/// Response object of the `Network::canClearBrowserCache` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanClearBrowserCacheResponse { | |
/// True if browser cache can be cleared. | |
pub result: Boolean, | |
} | |
impl Method for CanClearBrowserCache { | |
const NAME: &'static str = "Network.canClearBrowserCache"; | |
type ReturnObject = CanClearBrowserCacheReturnObject; | |
} | |
/// Method parameters of the `Network::canClearBrowserCookies` command. | |
#[deprecated] | |
pub type CanClearBrowserCookies = CanClearBrowserCookiesRequest; | |
/// Return object of the `Network::canClearBrowserCookies` command. | |
#[deprecated] | |
pub type CanClearBrowserCookiesReturnObject = CanClearBrowserCookiesResponse; | |
/// Request object of the `Network::canClearBrowserCookies` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanClearBrowserCookiesRequest { | |
} | |
/// Response object of the `Network::canClearBrowserCookies` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanClearBrowserCookiesResponse { | |
/// True if browser cookies can be cleared. | |
pub result: Boolean, | |
} | |
impl Method for CanClearBrowserCookies { | |
const NAME: &'static str = "Network.canClearBrowserCookies"; | |
type ReturnObject = CanClearBrowserCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::canEmulateNetworkConditions` command. | |
#[deprecated] | |
pub type CanEmulateNetworkConditions = CanEmulateNetworkConditionsRequest; | |
/// Return object of the `Network::canEmulateNetworkConditions` command. | |
#[deprecated] | |
pub type CanEmulateNetworkConditionsReturnObject = CanEmulateNetworkConditionsResponse; | |
/// Request object of the `Network::canEmulateNetworkConditions` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanEmulateNetworkConditionsRequest { | |
} | |
/// Response object of the `Network::canEmulateNetworkConditions` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CanEmulateNetworkConditionsResponse { | |
/// True if emulation of network conditions is supported. | |
pub result: Boolean, | |
} | |
impl Method for CanEmulateNetworkConditions { | |
const NAME: &'static str = "Network.canEmulateNetworkConditions"; | |
type ReturnObject = CanEmulateNetworkConditionsReturnObject; | |
} | |
/// Method parameters of the `Network::clearBrowserCache` command. | |
pub type ClearBrowserCache = ClearBrowserCacheRequest; | |
/// Return object of the `Network::clearBrowserCache` command. | |
pub type ClearBrowserCacheReturnObject = ClearBrowserCacheResponse; | |
/// Request object of the `Network::clearBrowserCache` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearBrowserCacheRequest { | |
} | |
/// Response object of the `Network::clearBrowserCache` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearBrowserCacheResponse { | |
} | |
impl Method for ClearBrowserCache { | |
const NAME: &'static str = "Network.clearBrowserCache"; | |
type ReturnObject = ClearBrowserCacheReturnObject; | |
} | |
/// Method parameters of the `Network::clearBrowserCookies` command. | |
pub type ClearBrowserCookies = ClearBrowserCookiesRequest; | |
/// Return object of the `Network::clearBrowserCookies` command. | |
pub type ClearBrowserCookiesReturnObject = ClearBrowserCookiesResponse; | |
/// Request object of the `Network::clearBrowserCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearBrowserCookiesRequest { | |
} | |
/// Response object of the `Network::clearBrowserCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearBrowserCookiesResponse { | |
} | |
impl Method for ClearBrowserCookies { | |
const NAME: &'static str = "Network.clearBrowserCookies"; | |
type ReturnObject = ClearBrowserCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::continueInterceptedRequest` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ContinueInterceptedRequest = ContinueInterceptedRequestRequest; | |
/// Return object of the `Network::continueInterceptedRequest` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ContinueInterceptedRequestReturnObject = ContinueInterceptedRequestResponse; | |
/// Request object of the `Network::continueInterceptedRequest` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ContinueInterceptedRequestRequest { | |
pub interception_id: InterceptionId, | |
/// If set this causes the request to fail with the given reason. Passing `Aborted` for requests | |
/// marked with `isNavigationRequest` also cancels the navigation. Must not be set in response | |
/// to an authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub error_reason: Option<ErrorReason>, | |
/// If set the requests completes using with the provided base64 encoded raw response, including | |
/// HTTP status line and headers etc... Must not be set in response to an authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub raw_response: Option<Binary>, | |
/// If set the request url will be modified in a way that's not observable by page. Must not be | |
/// set in response to an authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// If set this allows the request method to be overridden. Must not be set in response to an | |
/// authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub method: Option<String>, | |
/// If set this allows postData to be set. Must not be set in response to an authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub post_data: Option<String>, | |
/// If set this allows the request headers to be changed. Must not be set in response to an | |
/// authChallenge. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub headers: Option<Headers>, | |
/// Response to a requestIntercepted with an authChallenge. Must not be set otherwise. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub auth_challenge_response: Option<AuthChallengeResponse>, | |
} | |
/// Response object of the `Network::continueInterceptedRequest` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ContinueInterceptedRequestResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ContinueInterceptedRequest { | |
const NAME: &'static str = "Network.continueInterceptedRequest"; | |
type ReturnObject = ContinueInterceptedRequestReturnObject; | |
} | |
/// Method parameters of the `Network::deleteCookies` command. | |
pub type DeleteCookies = DeleteCookiesRequest; | |
/// Return object of the `Network::deleteCookies` command. | |
pub type DeleteCookiesReturnObject = DeleteCookiesResponse; | |
/// Request object of the `Network::deleteCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCookiesRequest { | |
/// Name of the cookies to remove. | |
pub name: String, | |
/// If specified, deletes all the cookies with the given name where domain and path match | |
/// provided URL. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// If specified, deletes only cookies with the exact domain. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub domain: Option<String>, | |
/// If specified, deletes only cookies with the exact path. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub path: Option<String>, | |
} | |
/// Response object of the `Network::deleteCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCookiesResponse { | |
} | |
impl Method for DeleteCookies { | |
const NAME: &'static str = "Network.deleteCookies"; | |
type ReturnObject = DeleteCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Network::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Network::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Network::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Network.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Network::emulateNetworkConditions` command. | |
pub type EmulateNetworkConditions = EmulateNetworkConditionsRequest; | |
/// Return object of the `Network::emulateNetworkConditions` command. | |
pub type EmulateNetworkConditionsReturnObject = EmulateNetworkConditionsResponse; | |
/// Request object of the `Network::emulateNetworkConditions` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EmulateNetworkConditionsRequest { | |
/// True to emulate internet disconnection. | |
pub offline: Boolean, | |
/// Minimum latency from request sent to response headers received (ms). | |
pub latency: Number, | |
/// Maximal aggregated download throughput (bytes/sec). -1 disables download throttling. | |
pub download_throughput: Number, | |
/// Maximal aggregated upload throughput (bytes/sec). -1 disables upload throttling. | |
pub upload_throughput: Number, | |
/// Connection type if known. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub connection_type: Option<ConnectionType>, | |
} | |
/// Response object of the `Network::emulateNetworkConditions` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EmulateNetworkConditionsResponse { | |
} | |
impl Method for EmulateNetworkConditions { | |
const NAME: &'static str = "Network.emulateNetworkConditions"; | |
type ReturnObject = EmulateNetworkConditionsReturnObject; | |
} | |
/// Method parameters of the `Network::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Network::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Network::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
/// Buffer size in bytes to use when preserving network payloads (XHRs, etc). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub max_total_buffer_size: Option<Integer>, | |
/// Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc). | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub max_resource_buffer_size: Option<Integer>, | |
/// Longest post body size (in bytes) that would be included in requestWillBeSent notification | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub max_post_data_size: Option<Integer>, | |
} | |
/// Response object of the `Network::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Network.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Network::getAllCookies` command. | |
pub type GetAllCookies = GetAllCookiesRequest; | |
/// Return object of the `Network::getAllCookies` command. | |
pub type GetAllCookiesReturnObject = GetAllCookiesResponse; | |
/// Request object of the `Network::getAllCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAllCookiesRequest { | |
} | |
/// Response object of the `Network::getAllCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAllCookiesResponse { | |
/// Array of cookie objects. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub cookies: Vec<Cookie>, | |
} | |
impl Method for GetAllCookies { | |
const NAME: &'static str = "Network.getAllCookies"; | |
type ReturnObject = GetAllCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::getCertificate` command. | |
#[cfg(feature = "experimental")] | |
pub type GetCertificate = GetCertificateRequest; | |
/// Return object of the `Network::getCertificate` command. | |
#[cfg(feature = "experimental")] | |
pub type GetCertificateReturnObject = GetCertificateResponse; | |
/// Request object of the `Network::getCertificate` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCertificateRequest { | |
/// Origin to get certificate for. | |
pub origin: String, | |
} | |
/// Response object of the `Network::getCertificate` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCertificateResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub table_names: Vec<String>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetCertificate { | |
const NAME: &'static str = "Network.getCertificate"; | |
type ReturnObject = GetCertificateReturnObject; | |
} | |
/// Method parameters of the `Network::getCookies` command. | |
pub type GetCookies = GetCookiesRequest; | |
/// Return object of the `Network::getCookies` command. | |
pub type GetCookiesReturnObject = GetCookiesResponse; | |
/// Request object of the `Network::getCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCookiesRequest { | |
/// The list of URLs for which applicable cookies will be fetched | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub urls: Option<Vec<String>>, | |
} | |
/// Response object of the `Network::getCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCookiesResponse { | |
/// Array of cookie objects. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub cookies: Vec<Cookie>, | |
} | |
impl Method for GetCookies { | |
const NAME: &'static str = "Network.getCookies"; | |
type ReturnObject = GetCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::getResponseBody` command. | |
pub type GetResponseBody = GetResponseBodyRequest; | |
/// Return object of the `Network::getResponseBody` command. | |
pub type GetResponseBodyReturnObject = GetResponseBodyResponse; | |
/// Request object of the `Network::getResponseBody` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResponseBodyRequest { | |
/// Identifier of the network request to get content for. | |
pub request_id: RequestId, | |
} | |
/// Response object of the `Network::getResponseBody` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResponseBodyResponse { | |
/// Response body. | |
pub body: String, | |
/// True, if content was sent as base64. | |
pub base64_encoded: Boolean, | |
} | |
impl Method for GetResponseBody { | |
const NAME: &'static str = "Network.getResponseBody"; | |
type ReturnObject = GetResponseBodyReturnObject; | |
} | |
/// Method parameters of the `Network::getRequestPostData` command. | |
pub type GetRequestPostData = GetRequestPostDataRequest; | |
/// Return object of the `Network::getRequestPostData` command. | |
pub type GetRequestPostDataReturnObject = GetRequestPostDataResponse; | |
/// Request object of the `Network::getRequestPostData` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetRequestPostDataRequest { | |
/// Identifier of the network request to get content for. | |
pub request_id: RequestId, | |
} | |
/// Response object of the `Network::getRequestPostData` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetRequestPostDataResponse { | |
/// Request body string, omitting files from multipart requests | |
pub post_data: String, | |
} | |
impl Method for GetRequestPostData { | |
const NAME: &'static str = "Network.getRequestPostData"; | |
type ReturnObject = GetRequestPostDataReturnObject; | |
} | |
/// Method parameters of the `Network::getResponseBodyForInterception` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResponseBodyForInterception = GetResponseBodyForInterceptionRequest; | |
/// Return object of the `Network::getResponseBodyForInterception` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResponseBodyForInterceptionReturnObject = GetResponseBodyForInterceptionResponse; | |
/// Request object of the `Network::getResponseBodyForInterception` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResponseBodyForInterceptionRequest { | |
/// Identifier for the intercepted request to get body for. | |
pub interception_id: InterceptionId, | |
} | |
/// Response object of the `Network::getResponseBodyForInterception` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResponseBodyForInterceptionResponse { | |
/// Response body. | |
pub body: String, | |
/// True, if content was sent as base64. | |
pub base64_encoded: Boolean, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetResponseBodyForInterception { | |
const NAME: &'static str = "Network.getResponseBodyForInterception"; | |
type ReturnObject = GetResponseBodyForInterceptionReturnObject; | |
} | |
/// Method parameters of the `Network::takeResponseBodyForInterceptionAsStream` command. | |
#[cfg(feature = "experimental")] | |
pub type TakeResponseBodyForInterceptionAsStream = TakeResponseBodyForInterceptionAsStreamRequest; | |
/// Return object of the `Network::takeResponseBodyForInterceptionAsStream` command. | |
#[cfg(feature = "experimental")] | |
pub type TakeResponseBodyForInterceptionAsStreamReturnObject = TakeResponseBodyForInterceptionAsStreamResponse; | |
/// Request object of the `Network::takeResponseBodyForInterceptionAsStream` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TakeResponseBodyForInterceptionAsStreamRequest { | |
pub interception_id: InterceptionId, | |
} | |
/// Response object of the `Network::takeResponseBodyForInterceptionAsStream` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct TakeResponseBodyForInterceptionAsStreamResponse { | |
pub stream: io::StreamHandle, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for TakeResponseBodyForInterceptionAsStream { | |
const NAME: &'static str = "Network.takeResponseBodyForInterceptionAsStream"; | |
type ReturnObject = TakeResponseBodyForInterceptionAsStreamReturnObject; | |
} | |
/// Method parameters of the `Network::replayXHR` command. | |
#[cfg(feature = "experimental")] | |
pub type ReplayXHR = ReplayXHRRequest; | |
/// Return object of the `Network::replayXHR` command. | |
#[cfg(feature = "experimental")] | |
pub type ReplayXHRReturnObject = ReplayXHRResponse; | |
/// Request object of the `Network::replayXHR` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReplayXHRRequest { | |
/// Identifier of XHR to replay. | |
pub request_id: RequestId, | |
} | |
/// Response object of the `Network::replayXHR` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReplayXHRResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ReplayXHR { | |
const NAME: &'static str = "Network.replayXHR"; | |
type ReturnObject = ReplayXHRReturnObject; | |
} | |
/// Method parameters of the `Network::searchInResponseBody` command. | |
#[cfg(feature = "experimental")] | |
pub type SearchInResponseBody = SearchInResponseBodyRequest; | |
/// Return object of the `Network::searchInResponseBody` command. | |
#[cfg(feature = "experimental")] | |
pub type SearchInResponseBodyReturnObject = SearchInResponseBodyResponse; | |
/// Request object of the `Network::searchInResponseBody` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SearchInResponseBodyRequest { | |
/// Identifier of the network response to search. | |
pub request_id: RequestId, | |
/// String to search for. | |
pub query: String, | |
/// If true, search is case sensitive. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub case_sensitive: Option<Boolean>, | |
/// If true, treats string parameter as regex. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_regex: Option<Boolean>, | |
} | |
/// Response object of the `Network::searchInResponseBody` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SearchInResponseBodyResponse { | |
/// List of search matches. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub result: Vec<debugger::SearchMatch>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SearchInResponseBody { | |
const NAME: &'static str = "Network.searchInResponseBody"; | |
type ReturnObject = SearchInResponseBodyReturnObject; | |
} | |
/// Method parameters of the `Network::setBlockedURLs` command. | |
#[cfg(feature = "experimental")] | |
pub type SetBlockedURLs = SetBlockedURLsRequest; | |
/// Return object of the `Network::setBlockedURLs` command. | |
#[cfg(feature = "experimental")] | |
pub type SetBlockedURLsReturnObject = SetBlockedURLsResponse; | |
/// Request object of the `Network::setBlockedURLs` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetBlockedURLsRequest { | |
/// URL patterns to block. Wildcards ('*') are allowed. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub urls: Vec<String>, | |
} | |
/// Response object of the `Network::setBlockedURLs` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetBlockedURLsResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetBlockedURLs { | |
const NAME: &'static str = "Network.setBlockedURLs"; | |
type ReturnObject = SetBlockedURLsReturnObject; | |
} | |
/// Method parameters of the `Network::setBypassServiceWorker` command. | |
#[cfg(feature = "experimental")] | |
pub type SetBypassServiceWorker = SetBypassServiceWorkerRequest; | |
/// Return object of the `Network::setBypassServiceWorker` command. | |
#[cfg(feature = "experimental")] | |
pub type SetBypassServiceWorkerReturnObject = SetBypassServiceWorkerResponse; | |
/// Request object of the `Network::setBypassServiceWorker` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetBypassServiceWorkerRequest { | |
/// Bypass service worker and load from network. | |
pub bypass: Boolean, | |
} | |
/// Response object of the `Network::setBypassServiceWorker` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetBypassServiceWorkerResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetBypassServiceWorker { | |
const NAME: &'static str = "Network.setBypassServiceWorker"; | |
type ReturnObject = SetBypassServiceWorkerReturnObject; | |
} | |
/// Method parameters of the `Network::setCacheDisabled` command. | |
pub type SetCacheDisabled = SetCacheDisabledRequest; | |
/// Return object of the `Network::setCacheDisabled` command. | |
pub type SetCacheDisabledReturnObject = SetCacheDisabledResponse; | |
/// Request object of the `Network::setCacheDisabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCacheDisabledRequest { | |
/// Cache disabled state. | |
pub cache_disabled: Boolean, | |
} | |
/// Response object of the `Network::setCacheDisabled` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCacheDisabledResponse { | |
} | |
impl Method for SetCacheDisabled { | |
const NAME: &'static str = "Network.setCacheDisabled"; | |
type ReturnObject = SetCacheDisabledReturnObject; | |
} | |
/// Method parameters of the `Network::setCookie` command. | |
pub type SetCookie = SetCookieRequest; | |
/// Return object of the `Network::setCookie` command. | |
pub type SetCookieReturnObject = SetCookieResponse; | |
/// Request object of the `Network::setCookie` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCookieRequest { | |
/// Cookie name. | |
pub name: String, | |
/// Cookie value. | |
pub value: String, | |
/// The request-URI to associate with the setting of the cookie. This value can affect the | |
/// default domain and path values of the created cookie. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url: Option<String>, | |
/// Cookie domain. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub domain: Option<String>, | |
/// Cookie path. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub path: Option<String>, | |
/// True if cookie is secure. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub secure: Option<Boolean>, | |
/// True if cookie is http-only. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub http_only: Option<Boolean>, | |
/// Cookie SameSite type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub same_site: Option<CookieSameSite>, | |
/// Cookie expiration date, session cookie if not set | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub expires: Option<TimeSinceEpoch>, | |
} | |
/// Response object of the `Network::setCookie` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCookieResponse { | |
/// True if successfully set cookie. | |
pub success: Boolean, | |
} | |
impl Method for SetCookie { | |
const NAME: &'static str = "Network.setCookie"; | |
type ReturnObject = SetCookieReturnObject; | |
} | |
/// Method parameters of the `Network::setCookies` command. | |
pub type SetCookies = SetCookiesRequest; | |
/// Return object of the `Network::setCookies` command. | |
pub type SetCookiesReturnObject = SetCookiesResponse; | |
/// Request object of the `Network::setCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCookiesRequest { | |
/// Cookies to be set. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub cookies: Vec<CookieParam>, | |
} | |
/// Response object of the `Network::setCookies` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetCookiesResponse { | |
} | |
impl Method for SetCookies { | |
const NAME: &'static str = "Network.setCookies"; | |
type ReturnObject = SetCookiesReturnObject; | |
} | |
/// Method parameters of the `Network::setDataSizeLimitsForTest` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDataSizeLimitsForTest = SetDataSizeLimitsForTestRequest; | |
/// Return object of the `Network::setDataSizeLimitsForTest` command. | |
#[cfg(feature = "experimental")] | |
pub type SetDataSizeLimitsForTestReturnObject = SetDataSizeLimitsForTestResponse; | |
/// Request object of the `Network::setDataSizeLimitsForTest` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDataSizeLimitsForTestRequest { | |
/// Maximum total buffer size. | |
pub max_total_size: Integer, | |
/// Maximum per-resource size. | |
pub max_resource_size: Integer, | |
} | |
/// Response object of the `Network::setDataSizeLimitsForTest` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetDataSizeLimitsForTestResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetDataSizeLimitsForTest { | |
const NAME: &'static str = "Network.setDataSizeLimitsForTest"; | |
type ReturnObject = SetDataSizeLimitsForTestReturnObject; | |
} | |
/// Method parameters of the `Network::setExtraHTTPHeaders` command. | |
pub type SetExtraHTTPHeaders = SetExtraHTTPHeadersRequest; | |
/// Return object of the `Network::setExtraHTTPHeaders` command. | |
pub type SetExtraHTTPHeadersReturnObject = SetExtraHTTPHeadersResponse; | |
/// Request object of the `Network::setExtraHTTPHeaders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetExtraHTTPHeadersRequest { | |
/// Map with extra HTTP headers. | |
pub headers: Headers, | |
} | |
/// Response object of the `Network::setExtraHTTPHeaders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetExtraHTTPHeadersResponse { | |
} | |
impl Method for SetExtraHTTPHeaders { | |
const NAME: &'static str = "Network.setExtraHTTPHeaders"; | |
type ReturnObject = SetExtraHTTPHeadersReturnObject; | |
} | |
/// Method parameters of the `Network::setRequestInterception` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetRequestInterception = SetRequestInterceptionRequest; | |
/// Return object of the `Network::setRequestInterception` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type SetRequestInterceptionReturnObject = SetRequestInterceptionResponse; | |
/// Request object of the `Network::setRequestInterception` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRequestInterceptionRequest { | |
/// Requests matching any of these patterns will be forwarded and wait for the corresponding | |
/// continueInterceptedRequest call. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub patterns: Vec<RequestPattern>, | |
} | |
/// Response object of the `Network::setRequestInterception` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetRequestInterceptionResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for SetRequestInterception { | |
const NAME: &'static str = "Network.setRequestInterception"; | |
type ReturnObject = SetRequestInterceptionReturnObject; | |
} | |
/// Method parameters of the `Network::setUserAgentOverride` command. | |
pub type SetUserAgentOverride = SetUserAgentOverrideRequest; | |
/// Return object of the `Network::setUserAgentOverride` command. | |
pub type SetUserAgentOverrideReturnObject = SetUserAgentOverrideResponse; | |
/// Request object of the `Network::setUserAgentOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetUserAgentOverrideRequest { | |
/// User agent to use. | |
pub user_agent: String, | |
/// Browser langugage to emulate. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub accept_language: Option<String>, | |
/// The platform navigator.platform should return. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub platform: Option<String>, | |
} | |
/// Response object of the `Network::setUserAgentOverride` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetUserAgentOverrideResponse { | |
} | |
impl Method for SetUserAgentOverride { | |
const NAME: &'static str = "Network.setUserAgentOverride"; | |
type ReturnObject = SetUserAgentOverrideReturnObject; | |
} | |
/// Fired when data chunk was received over the network. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DataReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Data chunk length. | |
pub data_length: Integer, | |
/// Actual bytes received (might be less than dataLength for compressed encodings). | |
pub encoded_data_length: Integer, | |
} | |
/// Fired when EventSource message is received. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EventSourceMessageReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Message type. | |
pub event_name: String, | |
/// Message identifier. | |
pub event_id: String, | |
/// Message content. | |
pub data: String, | |
} | |
/// Fired when HTTP request has failed to load. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LoadingFailedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Resource type. | |
#[serde(rename = "type")] | |
pub r#type: ResourceType, | |
/// User friendly error message. | |
pub error_text: String, | |
/// True if loading was canceled. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub canceled: Option<Boolean>, | |
/// The reason why loading was blocked, if any. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub blocked_reason: Option<BlockedReason>, | |
} | |
/// Fired when HTTP request has finished loading. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LoadingFinishedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Total number of bytes received for this request. | |
pub encoded_data_length: Number, | |
/// Set when 1) response was blocked by Cross-Origin Read Blocking and also | |
/// 2) this needs to be reported to the DevTools console. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub should_report_corb_blocking: Option<Boolean>, | |
} | |
/// Details of an intercepted HTTP request, which must be either allowed, blocked, modified or | |
/// mocked. | |
/// Deprecated, use Fetch.requestPaused instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestInterceptedEvent { | |
/// Each request the page makes will have a unique id, however if any redirects are encountered | |
/// while processing that fetch, they will be reported with the same id as the original fetch. | |
/// Likewise if HTTP authentication is needed then the same fetch id will be used. | |
pub interception_id: InterceptionId, | |
pub request: Request, | |
/// The id of the frame that initiated the request. | |
pub frame_id: page::FrameId, | |
/// How the requested resource will be used. | |
pub resource_type: ResourceType, | |
/// Whether this is a navigation request, which can abort the navigation completely. | |
pub is_navigation_request: Boolean, | |
/// Set if the request is a navigation that will result in a download. | |
/// Only present after response is received from the server (i.e. HeadersReceived stage). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub is_download: Option<Boolean>, | |
/// Redirect location, only sent if a redirect was intercepted. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub redirect_url: Option<String>, | |
/// Details of the Authorization Challenge encountered. If this is set then | |
/// continueInterceptedRequest must contain an authChallengeResponse. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub auth_challenge: Option<AuthChallenge>, | |
/// Response error if intercepted at response stage or if redirect occurred while intercepting | |
/// request. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub response_error_reason: Option<ErrorReason>, | |
/// Response code if intercepted at response stage or if redirect occurred while intercepting | |
/// request or auth retry occurred. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub response_status_code: Option<Integer>, | |
/// Response headers if intercepted at the response stage or if redirect occurred while | |
/// intercepting request or auth retry occurred. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub response_headers: Option<Headers>, | |
/// If the intercepted request had a corresponding requestWillBeSent event fired for it, then | |
/// this requestId will be the same as the requestId present in the requestWillBeSent event. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub request_id: Option<RequestId>, | |
} | |
/// Fired if request ended up loading from cache. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestServedFromCacheEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
} | |
/// Fired when page is about to send HTTP request. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestWillBeSentEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Loader identifier. Empty string if the request is fetched from worker. | |
pub loader_id: LoaderId, | |
/// URL of the document this request is loaded for. | |
#[serde(rename = "documentURL")] | |
pub document_url: String, | |
/// Request data. | |
pub request: Request, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Timestamp. | |
pub wall_time: TimeSinceEpoch, | |
/// Request initiator. | |
pub initiator: Initiator, | |
/// Redirect response data. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub redirect_response: Option<Response>, | |
/// Type of this resource. | |
#[serde(rename = "type")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub r#type: Option<ResourceType>, | |
/// Frame identifier. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_id: Option<page::FrameId>, | |
/// Whether the request is initiated by a user gesture. Defaults to false. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub has_user_gesture: Option<Boolean>, | |
} | |
/// Fired when resource loading priority is changed | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResourceChangedPriorityEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// New priority | |
pub new_priority: ResourcePriority, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
} | |
/// Fired when a signed exchange was received over the network | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SignedExchangeReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Information about the signed exchange response. | |
pub info: SignedExchangeInfo, | |
} | |
/// Fired when HTTP response is available. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResponseReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Loader identifier. Empty string if the request is fetched from worker. | |
pub loader_id: LoaderId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// Resource type. | |
#[serde(rename = "type")] | |
pub r#type: ResourceType, | |
/// Response data. | |
pub response: Response, | |
/// Frame identifier. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_id: Option<page::FrameId>, | |
} | |
/// Fired when WebSocket is closed. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketClosedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
} | |
/// Fired upon WebSocket creation. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketCreatedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// WebSocket request URL. | |
pub url: String, | |
/// Request initiator. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub initiator: Option<Initiator>, | |
} | |
/// Fired when WebSocket message error occurs. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketFrameErrorEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// WebSocket error message. | |
pub error_message: String, | |
} | |
/// Fired when WebSocket message is received. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketFrameReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// WebSocket response data. | |
pub response: WebSocketFrame, | |
} | |
/// Fired when WebSocket message is sent. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketFrameSentEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// WebSocket response data. | |
pub response: WebSocketFrame, | |
} | |
/// Fired when WebSocket handshake response becomes available. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketHandshakeResponseReceivedEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// WebSocket response data. | |
pub response: WebSocketResponse, | |
} | |
/// Fired when WebSocket is about to initiate handshake. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct WebSocketWillSendHandshakeRequestEvent { | |
/// Request identifier. | |
pub request_id: RequestId, | |
/// Timestamp. | |
pub timestamp: MonotonicTime, | |
/// UTC Timestamp. | |
pub wall_time: TimeSinceEpoch, | |
/// WebSocket request data. | |
pub request: WebSocketRequest, | |
} | |
/// Fired when additional information about a requestWillBeSent event is available from the | |
/// network stack. Not every requestWillBeSent event will have an additional | |
/// requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent | |
/// or requestWillBeSentExtraInfo will be fired first for the same request. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RequestWillBeSentExtraInfoEvent { | |
/// Request identifier. Used to match this information to an existing requestWillBeSent event. | |
pub request_id: RequestId, | |
/// A list of cookies which will not be sent with this request along with corresponding reasons | |
/// for blocking. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub blocked_cookies: Vec<BlockedCookieWithReason>, | |
/// Raw request headers as they will be sent over the wire. | |
pub headers: Headers, | |
} | |
/// Fired when additional information about a responseReceived event is available from the network | |
/// stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for | |
/// it, and responseReceivedExtraInfo may be fired before or after responseReceived. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResponseReceivedExtraInfoEvent { | |
/// Request identifier. Used to match this information to another responseReceived event. | |
pub request_id: RequestId, | |
/// A list of cookies which were not stored from the response along with the corresponding | |
/// reasons for blocking. The cookies here may not be valid due to syntax errors, which | |
/// are represented by the invalid cookie line string instead of a proper cookie. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub blocked_cookies: Vec<BlockedSetCookieWithReason>, | |
/// Raw response headers as they were received over the wire. | |
pub headers: Headers, | |
/// Raw response header text as it was received over the wire. The raw text may not always be | |
/// available, such as in the case of HTTP/2 or QUIC. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub headers_text: Option<String>, | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Fired when data chunk was received over the network. | |
#[serde(rename = "Network.dataReceived")] | |
DataReceived(DataReceivedEvent), | |
/// Fired when EventSource message is received. | |
#[serde(rename = "Network.eventSourceMessageReceived")] | |
EventSourceMessageReceived(EventSourceMessageReceivedEvent), | |
/// Fired when HTTP request has failed to load. | |
#[serde(rename = "Network.loadingFailed")] | |
LoadingFailed(LoadingFailedEvent), | |
/// Fired when HTTP request has finished loading. | |
#[serde(rename = "Network.loadingFinished")] | |
LoadingFinished(LoadingFinishedEvent), | |
/// Details of an intercepted HTTP request, which must be either allowed, blocked, modified or | |
/// mocked. | |
/// Deprecated, use Fetch.requestPaused instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[serde(rename = "Network.requestIntercepted")] | |
RequestIntercepted(RequestInterceptedEvent), | |
/// Fired if request ended up loading from cache. | |
#[serde(rename = "Network.requestServedFromCache")] | |
RequestServedFromCache(RequestServedFromCacheEvent), | |
/// Fired when page is about to send HTTP request. | |
#[serde(rename = "Network.requestWillBeSent")] | |
RequestWillBeSent(RequestWillBeSentEvent), | |
/// Fired when resource loading priority is changed | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "Network.resourceChangedPriority")] | |
ResourceChangedPriority(ResourceChangedPriorityEvent), | |
/// Fired when a signed exchange was received over the network | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "Network.signedExchangeReceived")] | |
SignedExchangeReceived(SignedExchangeReceivedEvent), | |
/// Fired when HTTP response is available. | |
#[serde(rename = "Network.responseReceived")] | |
ResponseReceived(ResponseReceivedEvent), | |
/// Fired when WebSocket is closed. | |
#[serde(rename = "Network.webSocketClosed")] | |
WebSocketClosed(WebSocketClosedEvent), | |
/// Fired upon WebSocket creation. | |
#[serde(rename = "Network.webSocketCreated")] | |
WebSocketCreated(WebSocketCreatedEvent), | |
/// Fired when WebSocket message error occurs. | |
#[serde(rename = "Network.webSocketFrameError")] | |
WebSocketFrameError(WebSocketFrameErrorEvent), | |
/// Fired when WebSocket message is received. | |
#[serde(rename = "Network.webSocketFrameReceived")] | |
WebSocketFrameReceived(WebSocketFrameReceivedEvent), | |
/// Fired when WebSocket message is sent. | |
#[serde(rename = "Network.webSocketFrameSent")] | |
WebSocketFrameSent(WebSocketFrameSentEvent), | |
/// Fired when WebSocket handshake response becomes available. | |
#[serde(rename = "Network.webSocketHandshakeResponseReceived")] | |
WebSocketHandshakeResponseReceived(WebSocketHandshakeResponseReceivedEvent), | |
/// Fired when WebSocket is about to initiate handshake. | |
#[serde(rename = "Network.webSocketWillSendHandshakeRequest")] | |
WebSocketWillSendHandshakeRequest(WebSocketWillSendHandshakeRequestEvent), | |
/// Fired when additional information about a requestWillBeSent event is available from the | |
/// network stack. Not every requestWillBeSent event will have an additional | |
/// requestWillBeSentExtraInfo fired for it, and there is no guarantee whether requestWillBeSent | |
/// or requestWillBeSentExtraInfo will be fired first for the same request. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "Network.requestWillBeSentExtraInfo")] | |
RequestWillBeSentExtraInfo(RequestWillBeSentExtraInfoEvent), | |
/// Fired when additional information about a responseReceived event is available from the network | |
/// stack. Not every responseReceived event will have an additional responseReceivedExtraInfo for | |
/// it, and responseReceivedExtraInfo may be fired before or after responseReceived. | |
#[cfg(feature = "experimental")] | |
#[serde(rename = "Network.responseReceivedExtraInfo")] | |
ResponseReceivedExtraInfo(ResponseReceivedExtraInfoEvent), | |
} | |
} | |
/// This domain provides various functionality related to drawing atop the inspected page. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "overlay"))] | |
pub trait Overlay: DOM + Page + Runtime { | |
type Error; | |
/// Disables domain notifications. | |
fn disable(&mut self) -> Result<(), <Self as Overlay>::Error>; | |
/// Enables domain notifications. | |
fn enable(&mut self) -> Result<(), <Self as Overlay>::Error>; | |
/// For testing. | |
fn get_highlight_object_for_test(&mut self, node_id: dom::NodeId, include_distance: Option<Boolean>, include_style: Option<Boolean>) -> Result<(Object), <Self as Overlay>::Error>; | |
/// Hides any highlight. | |
fn hide_highlight(&mut self) -> Result<(), <Self as Overlay>::Error>; | |
/// Highlights owner element of the frame with given id. | |
fn highlight_frame(&mut self, frame_id: page::FrameId, content_color: Option<dom::RGBA>, content_outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error>; | |
/// Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or | |
/// objectId must be specified. | |
fn highlight_node(&mut self, highlight_config: overlay::HighlightConfig, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, selector: Option<String>) -> Result<(), <Self as Overlay>::Error>; | |
/// Highlights given quad. Coordinates are absolute with respect to the main frame viewport. | |
fn highlight_quad(&mut self, quad: dom::Quad, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error>; | |
/// Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. | |
fn highlight_rect(&mut self, x: Integer, y: Integer, width: Integer, height: Integer, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error>; | |
/// Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. | |
/// Backend then generates 'inspectNodeRequested' event upon element selection. | |
fn set_inspect_mode(&mut self, mode: overlay::InspectMode, highlight_config: Option<overlay::HighlightConfig>) -> Result<(), <Self as Overlay>::Error>; | |
/// Highlights owner element of all frames detected to be ads. | |
fn set_show_ad_highlights(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
fn set_paused_in_debugger_message(&mut self, message: Option<String>) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows debug borders on layers | |
fn set_show_debug_borders(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows the FPS counter | |
fn set_show_fps_counter(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows paint rectangles | |
fn set_show_paint_rects(&mut self, result: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows layout shift regions | |
fn set_show_layout_shift_regions(&mut self, result: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows scroll bottleneck rects | |
fn set_show_scroll_bottleneck_rects(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Requests that backend shows hit-test borders on layers | |
fn set_show_hit_test_borders(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
/// Paints viewport size upon main frame resize. | |
fn set_show_viewport_size_on_resize(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error>; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "overlay"))] | |
impl<T> Overlay for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
fn disable(&mut self) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::EnableRequest {}).map(|_| ()) | |
} | |
fn get_highlight_object_for_test(&mut self, node_id: dom::NodeId, include_distance: Option<Boolean>, include_style: Option<Boolean>) -> Result<(Object), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::GetHighlightObjectForTestRequest { node_id, include_distance, include_style }).map(|res| (res.highlight)) | |
} | |
fn hide_highlight(&mut self) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::HideHighlightRequest {}).map(|_| ()) | |
} | |
fn highlight_frame(&mut self, frame_id: page::FrameId, content_color: Option<dom::RGBA>, content_outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::HighlightFrameRequest { frame_id, content_color, content_outline_color }).map(|_| ()) | |
} | |
fn highlight_node(&mut self, highlight_config: overlay::HighlightConfig, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, selector: Option<String>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::HighlightNodeRequest { highlight_config, node_id, backend_node_id, object_id, selector }).map(|_| ()) | |
} | |
fn highlight_quad(&mut self, quad: dom::Quad, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::HighlightQuadRequest { quad, color, outline_color }).map(|_| ()) | |
} | |
fn highlight_rect(&mut self, x: Integer, y: Integer, width: Integer, height: Integer, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::HighlightRectRequest { x, y, width, height, color, outline_color }).map(|_| ()) | |
} | |
fn set_inspect_mode(&mut self, mode: overlay::InspectMode, highlight_config: Option<overlay::HighlightConfig>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetInspectModeRequest { mode, highlight_config }).map(|_| ()) | |
} | |
fn set_show_ad_highlights(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowAdHighlightsRequest { show }).map(|_| ()) | |
} | |
fn set_paused_in_debugger_message(&mut self, message: Option<String>) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetPausedInDebuggerMessageRequest { message }).map(|_| ()) | |
} | |
fn set_show_debug_borders(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowDebugBordersRequest { show }).map(|_| ()) | |
} | |
fn set_show_fps_counter(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowFPSCounterRequest { show }).map(|_| ()) | |
} | |
fn set_show_paint_rects(&mut self, result: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowPaintRectsRequest { result }).map(|_| ()) | |
} | |
fn set_show_layout_shift_regions(&mut self, result: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowLayoutShiftRegionsRequest { result }).map(|_| ()) | |
} | |
fn set_show_scroll_bottleneck_rects(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowScrollBottleneckRectsRequest { show }).map(|_| ()) | |
} | |
fn set_show_hit_test_borders(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowHitTestBordersRequest { show }).map(|_| ()) | |
} | |
fn set_show_viewport_size_on_resize(&mut self, show: Boolean) -> Result<(), <Self as Overlay>::Error> { | |
CallSite::call(self, overlay::SetShowViewportSizeOnResizeRequest { show }).map(|_| ()) | |
} | |
} | |
/// This domain provides various functionality related to drawing atop the inspected page. | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "overlay")))] | |
pub trait AsyncOverlay: AsyncDOM + AsyncPage + AsyncRuntime where Self: Sized { | |
type Error; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type GetHighlightObjectForTest: futures::Future<Item = ((Object), Self), Error = <Self as AsyncOverlay>::Error>; | |
type HideHighlight: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type HighlightFrame: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type HighlightNode: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type HighlightQuad: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type HighlightRect: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetInspectMode: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowAdHighlights: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetPausedInDebuggerMessage: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowDebugBorders: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowFPSCounter: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowPaintRects: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowLayoutShiftRegions: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowScrollBottleneckRects: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowHitTestBorders: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
type SetShowViewportSizeOnResize: futures::Future<Item = ((), Self), Error = <Self as AsyncOverlay>::Error>; | |
/// Disables domain notifications. | |
fn disable(self) -> <Self as AsyncOverlay>::Disable; | |
/// Enables domain notifications. | |
fn enable(self) -> <Self as AsyncOverlay>::Enable; | |
/// For testing. | |
fn get_highlight_object_for_test(self, node_id: dom::NodeId, include_distance: Option<Boolean>, include_style: Option<Boolean>) -> <Self as AsyncOverlay>::GetHighlightObjectForTest; | |
/// Hides any highlight. | |
fn hide_highlight(self) -> <Self as AsyncOverlay>::HideHighlight; | |
/// Highlights owner element of the frame with given id. | |
fn highlight_frame(self, frame_id: page::FrameId, content_color: Option<dom::RGBA>, content_outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightFrame; | |
/// Highlights DOM node with given id or with the given JavaScript object wrapper. Either nodeId or | |
/// objectId must be specified. | |
fn highlight_node(self, highlight_config: overlay::HighlightConfig, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, selector: Option<String>) -> <Self as AsyncOverlay>::HighlightNode; | |
/// Highlights given quad. Coordinates are absolute with respect to the main frame viewport. | |
fn highlight_quad(self, quad: dom::Quad, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightQuad; | |
/// Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport. | |
fn highlight_rect(self, x: Integer, y: Integer, width: Integer, height: Integer, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightRect; | |
/// Enters the 'inspect' mode. In this mode, elements that user is hovering over are highlighted. | |
/// Backend then generates 'inspectNodeRequested' event upon element selection. | |
fn set_inspect_mode(self, mode: overlay::InspectMode, highlight_config: Option<overlay::HighlightConfig>) -> <Self as AsyncOverlay>::SetInspectMode; | |
/// Highlights owner element of all frames detected to be ads. | |
fn set_show_ad_highlights(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowAdHighlights; | |
fn set_paused_in_debugger_message(self, message: Option<String>) -> <Self as AsyncOverlay>::SetPausedInDebuggerMessage; | |
/// Requests that backend shows debug borders on layers | |
fn set_show_debug_borders(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowDebugBorders; | |
/// Requests that backend shows the FPS counter | |
fn set_show_fps_counter(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowFPSCounter; | |
/// Requests that backend shows paint rectangles | |
fn set_show_paint_rects(self, result: Boolean) -> <Self as AsyncOverlay>::SetShowPaintRects; | |
/// Requests that backend shows layout shift regions | |
fn set_show_layout_shift_regions(self, result: Boolean) -> <Self as AsyncOverlay>::SetShowLayoutShiftRegions; | |
/// Requests that backend shows scroll bottleneck rects | |
fn set_show_scroll_bottleneck_rects(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowScrollBottleneckRects; | |
/// Requests that backend shows hit-test borders on layers | |
fn set_show_hit_test_borders(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowHitTestBorders; | |
/// Paints viewport size upon main frame resize. | |
fn set_show_viewport_size_on_resize(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowViewportSizeOnResize; | |
} | |
#[cfg(feature = "experimental")] | |
#[cfg(all(feature = "async", any(feature = "all", feature = "overlay")))] | |
impl<T> AsyncOverlay for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetHighlightObjectForTest = Box<dyn futures::Future<Item = ((Object), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HideHighlight = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightFrame = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightNode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightQuad = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HighlightRect = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetInspectMode = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowAdHighlights = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetPausedInDebuggerMessage = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowDebugBorders = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowFPSCounter = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowPaintRects = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowLayoutShiftRegions = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowScrollBottleneckRects = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowHitTestBorders = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetShowViewportSizeOnResize = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
fn disable(self) -> <Self as AsyncOverlay>::Disable { | |
Box::new(AsyncCallSite::async_call(self, overlay::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncOverlay>::Enable { | |
Box::new(AsyncCallSite::async_call(self, overlay::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_highlight_object_for_test(self, node_id: dom::NodeId, include_distance: Option<Boolean>, include_style: Option<Boolean>) -> <Self as AsyncOverlay>::GetHighlightObjectForTest { | |
Box::new(AsyncCallSite::async_call(self, overlay::GetHighlightObjectForTestRequest { node_id, include_distance, include_style }).map(|(res, self_)| ((res.highlight), self_))) | |
} | |
fn hide_highlight(self) -> <Self as AsyncOverlay>::HideHighlight { | |
Box::new(AsyncCallSite::async_call(self, overlay::HideHighlightRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_frame(self, frame_id: page::FrameId, content_color: Option<dom::RGBA>, content_outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightFrame { | |
Box::new(AsyncCallSite::async_call(self, overlay::HighlightFrameRequest { frame_id, content_color, content_outline_color }).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_node(self, highlight_config: overlay::HighlightConfig, node_id: Option<dom::NodeId>, backend_node_id: Option<dom::BackendNodeId>, object_id: Option<runtime::RemoteObjectId>, selector: Option<String>) -> <Self as AsyncOverlay>::HighlightNode { | |
Box::new(AsyncCallSite::async_call(self, overlay::HighlightNodeRequest { highlight_config, node_id, backend_node_id, object_id, selector }).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_quad(self, quad: dom::Quad, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightQuad { | |
Box::new(AsyncCallSite::async_call(self, overlay::HighlightQuadRequest { quad, color, outline_color }).map(|(_, self_)| ((), self_))) | |
} | |
fn highlight_rect(self, x: Integer, y: Integer, width: Integer, height: Integer, color: Option<dom::RGBA>, outline_color: Option<dom::RGBA>) -> <Self as AsyncOverlay>::HighlightRect { | |
Box::new(AsyncCallSite::async_call(self, overlay::HighlightRectRequest { x, y, width, height, color, outline_color }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_inspect_mode(self, mode: overlay::InspectMode, highlight_config: Option<overlay::HighlightConfig>) -> <Self as AsyncOverlay>::SetInspectMode { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetInspectModeRequest { mode, highlight_config }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_ad_highlights(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowAdHighlights { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowAdHighlightsRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_paused_in_debugger_message(self, message: Option<String>) -> <Self as AsyncOverlay>::SetPausedInDebuggerMessage { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetPausedInDebuggerMessageRequest { message }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_debug_borders(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowDebugBorders { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowDebugBordersRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_fps_counter(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowFPSCounter { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowFPSCounterRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_paint_rects(self, result: Boolean) -> <Self as AsyncOverlay>::SetShowPaintRects { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowPaintRectsRequest { result }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_layout_shift_regions(self, result: Boolean) -> <Self as AsyncOverlay>::SetShowLayoutShiftRegions { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowLayoutShiftRegionsRequest { result }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_scroll_bottleneck_rects(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowScrollBottleneckRects { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowScrollBottleneckRectsRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_hit_test_borders(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowHitTestBorders { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowHitTestBordersRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_show_viewport_size_on_resize(self, show: Boolean) -> <Self as AsyncOverlay>::SetShowViewportSizeOnResize { | |
Box::new(AsyncCallSite::async_call(self, overlay::SetShowViewportSizeOnResizeRequest { show }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// This domain provides various functionality related to drawing atop the inspected page. | |
#[cfg(feature = "experimental")] | |
#[cfg(any(feature = "all", feature = "overlay"))] | |
#[allow(deprecated)] | |
pub mod overlay { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Configuration data for the highlighting of page elements. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightConfig { | |
/// Whether the node info tooltip should be shown (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub show_info: Option<Boolean>, | |
/// Whether the node styles in the tooltip (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub show_styles: Option<Boolean>, | |
/// Whether the rulers should be shown (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub show_rulers: Option<Boolean>, | |
/// Whether the extension lines from node to the rulers should be shown (default: false). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub show_extension_lines: Option<Boolean>, | |
/// The content box highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_color: Option<dom::RGBA>, | |
/// The padding highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub padding_color: Option<dom::RGBA>, | |
/// The border highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub border_color: Option<dom::RGBA>, | |
/// The margin highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub margin_color: Option<dom::RGBA>, | |
/// The event target element highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub event_target_color: Option<dom::RGBA>, | |
/// The shape outside fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shape_color: Option<dom::RGBA>, | |
/// The shape margin fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub shape_margin_color: Option<dom::RGBA>, | |
/// The grid layout color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub css_grid_color: Option<dom::RGBA>, | |
} | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum InspectMode { | |
SearchForNode, | |
SearchForUAShadowDOM, | |
CaptureAreaScreenshot, | |
ShowDistances, | |
None, | |
} | |
/// Method parameters of the `Overlay::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Overlay::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Overlay::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Overlay::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Overlay.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Overlay::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Overlay::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Overlay::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Overlay::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Overlay.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Overlay::getHighlightObjectForTest` command. | |
pub type GetHighlightObjectForTest = GetHighlightObjectForTestRequest; | |
/// Return object of the `Overlay::getHighlightObjectForTest` command. | |
pub type GetHighlightObjectForTestReturnObject = GetHighlightObjectForTestResponse; | |
/// Request object of the `Overlay::getHighlightObjectForTest` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHighlightObjectForTestRequest { | |
/// Id of the node to get highlight object for. | |
pub node_id: dom::NodeId, | |
/// Whether to include distance info. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_distance: Option<Boolean>, | |
/// Whether to include style info. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub include_style: Option<Boolean>, | |
} | |
/// Response object of the `Overlay::getHighlightObjectForTest` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetHighlightObjectForTestResponse { | |
/// Highlight data for the node. | |
pub highlight: Object, | |
} | |
impl Method for GetHighlightObjectForTest { | |
const NAME: &'static str = "Overlay.getHighlightObjectForTest"; | |
type ReturnObject = GetHighlightObjectForTestReturnObject; | |
} | |
/// Method parameters of the `Overlay::hideHighlight` command. | |
pub type HideHighlight = HideHighlightRequest; | |
/// Return object of the `Overlay::hideHighlight` command. | |
pub type HideHighlightReturnObject = HideHighlightResponse; | |
/// Request object of the `Overlay::hideHighlight` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HideHighlightRequest { | |
} | |
/// Response object of the `Overlay::hideHighlight` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HideHighlightResponse { | |
} | |
impl Method for HideHighlight { | |
const NAME: &'static str = "Overlay.hideHighlight"; | |
type ReturnObject = HideHighlightReturnObject; | |
} | |
/// Method parameters of the `Overlay::highlightFrame` command. | |
pub type HighlightFrame = HighlightFrameRequest; | |
/// Return object of the `Overlay::highlightFrame` command. | |
pub type HighlightFrameReturnObject = HighlightFrameResponse; | |
/// Request object of the `Overlay::highlightFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightFrameRequest { | |
/// Identifier of the frame to highlight. | |
pub frame_id: page::FrameId, | |
/// The content box highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_color: Option<dom::RGBA>, | |
/// The content box highlight outline color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_outline_color: Option<dom::RGBA>, | |
} | |
/// Response object of the `Overlay::highlightFrame` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightFrameResponse { | |
} | |
impl Method for HighlightFrame { | |
const NAME: &'static str = "Overlay.highlightFrame"; | |
type ReturnObject = HighlightFrameReturnObject; | |
} | |
/// Method parameters of the `Overlay::highlightNode` command. | |
pub type HighlightNode = HighlightNodeRequest; | |
/// Return object of the `Overlay::highlightNode` command. | |
pub type HighlightNodeReturnObject = HighlightNodeResponse; | |
/// Request object of the `Overlay::highlightNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightNodeRequest { | |
/// A descriptor for the highlight appearance. | |
pub highlight_config: HighlightConfig, | |
/// Identifier of the node to highlight. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub node_id: Option<dom::NodeId>, | |
/// Identifier of the backend node to highlight. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub backend_node_id: Option<dom::BackendNodeId>, | |
/// JavaScript object id of the node to be highlighted. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub object_id: Option<runtime::RemoteObjectId>, | |
/// Selectors to highlight relevant nodes. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub selector: Option<String>, | |
} | |
/// Response object of the `Overlay::highlightNode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightNodeResponse { | |
} | |
impl Method for HighlightNode { | |
const NAME: &'static str = "Overlay.highlightNode"; | |
type ReturnObject = HighlightNodeReturnObject; | |
} | |
/// Method parameters of the `Overlay::highlightQuad` command. | |
pub type HighlightQuad = HighlightQuadRequest; | |
/// Return object of the `Overlay::highlightQuad` command. | |
pub type HighlightQuadReturnObject = HighlightQuadResponse; | |
/// Request object of the `Overlay::highlightQuad` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightQuadRequest { | |
/// Quad to highlight | |
pub quad: dom::Quad, | |
/// The highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub color: Option<dom::RGBA>, | |
/// The highlight outline color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub outline_color: Option<dom::RGBA>, | |
} | |
/// Response object of the `Overlay::highlightQuad` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightQuadResponse { | |
} | |
impl Method for HighlightQuad { | |
const NAME: &'static str = "Overlay.highlightQuad"; | |
type ReturnObject = HighlightQuadReturnObject; | |
} | |
/// Method parameters of the `Overlay::highlightRect` command. | |
pub type HighlightRect = HighlightRectRequest; | |
/// Return object of the `Overlay::highlightRect` command. | |
pub type HighlightRectReturnObject = HighlightRectResponse; | |
/// Request object of the `Overlay::highlightRect` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightRectRequest { | |
/// X coordinate | |
pub x: Integer, | |
/// Y coordinate | |
pub y: Integer, | |
/// Rectangle width | |
pub width: Integer, | |
/// Rectangle height | |
pub height: Integer, | |
/// The highlight fill color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub color: Option<dom::RGBA>, | |
/// The highlight outline color (default: transparent). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub outline_color: Option<dom::RGBA>, | |
} | |
/// Response object of the `Overlay::highlightRect` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HighlightRectResponse { | |
} | |
impl Method for HighlightRect { | |
const NAME: &'static str = "Overlay.highlightRect"; | |
type ReturnObject = HighlightRectReturnObject; | |
} | |
/// Method parameters of the `Overlay::setInspectMode` command. | |
pub type SetInspectMode = SetInspectModeRequest; | |
/// Return object of the `Overlay::setInspectMode` command. | |
pub type SetInspectModeReturnObject = SetInspectModeResponse; | |
/// Request object of the `Overlay::setInspectMode` command. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInspectModeRequest { | |
/// Set an inspection mode. | |
pub mode: InspectMode, | |
/// A descriptor for the highlight appearance of hovered-over nodes. May be omitted if `enabled | |
/// == false`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub highlight_config: Option<HighlightConfig>, | |
} | |
/// Response object of the `Overlay::setInspectMode` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetInspectModeResponse { | |
} | |
impl Method for SetInspectMode { | |
const NAME: &'static str = "Overlay.setInspectMode"; | |
type ReturnObject = SetInspectModeReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowAdHighlights` command. | |
pub type SetShowAdHighlights = SetShowAdHighlightsRequest; | |
/// Return object of the `Overlay::setShowAdHighlights` command. | |
pub type SetShowAdHighlightsReturnObject = SetShowAdHighlightsResponse; | |
/// Request object of the `Overlay::setShowAdHighlights` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowAdHighlightsRequest { | |
/// True for showing ad highlights | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowAdHighlights` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowAdHighlightsResponse { | |
} | |
impl Method for SetShowAdHighlights { | |
const NAME: &'static str = "Overlay.setShowAdHighlights"; | |
type ReturnObject = SetShowAdHighlightsReturnObject; | |
} | |
/// Method parameters of the `Overlay::setPausedInDebuggerMessage` command. | |
pub type SetPausedInDebuggerMessage = SetPausedInDebuggerMessageRequest; | |
/// Return object of the `Overlay::setPausedInDebuggerMessage` command. | |
pub type SetPausedInDebuggerMessageReturnObject = SetPausedInDebuggerMessageResponse; | |
/// Request object of the `Overlay::setPausedInDebuggerMessage` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPausedInDebuggerMessageRequest { | |
/// The message to display, also triggers resume and step over controls. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub message: Option<String>, | |
} | |
/// Response object of the `Overlay::setPausedInDebuggerMessage` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetPausedInDebuggerMessageResponse { | |
} | |
impl Method for SetPausedInDebuggerMessage { | |
const NAME: &'static str = "Overlay.setPausedInDebuggerMessage"; | |
type ReturnObject = SetPausedInDebuggerMessageReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowDebugBorders` command. | |
pub type SetShowDebugBorders = SetShowDebugBordersRequest; | |
/// Return object of the `Overlay::setShowDebugBorders` command. | |
pub type SetShowDebugBordersReturnObject = SetShowDebugBordersResponse; | |
/// Request object of the `Overlay::setShowDebugBorders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowDebugBordersRequest { | |
/// True for showing debug borders | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowDebugBorders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowDebugBordersResponse { | |
} | |
impl Method for SetShowDebugBorders { | |
const NAME: &'static str = "Overlay.setShowDebugBorders"; | |
type ReturnObject = SetShowDebugBordersReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowFPSCounter` command. | |
pub type SetShowFPSCounter = SetShowFPSCounterRequest; | |
/// Return object of the `Overlay::setShowFPSCounter` command. | |
pub type SetShowFPSCounterReturnObject = SetShowFPSCounterResponse; | |
/// Request object of the `Overlay::setShowFPSCounter` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowFPSCounterRequest { | |
/// True for showing the FPS counter | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowFPSCounter` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowFPSCounterResponse { | |
} | |
impl Method for SetShowFPSCounter { | |
const NAME: &'static str = "Overlay.setShowFPSCounter"; | |
type ReturnObject = SetShowFPSCounterReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowPaintRects` command. | |
pub type SetShowPaintRects = SetShowPaintRectsRequest; | |
/// Return object of the `Overlay::setShowPaintRects` command. | |
pub type SetShowPaintRectsReturnObject = SetShowPaintRectsResponse; | |
/// Request object of the `Overlay::setShowPaintRects` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowPaintRectsRequest { | |
/// True for showing paint rectangles | |
pub result: Boolean, | |
} | |
/// Response object of the `Overlay::setShowPaintRects` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowPaintRectsResponse { | |
} | |
impl Method for SetShowPaintRects { | |
const NAME: &'static str = "Overlay.setShowPaintRects"; | |
type ReturnObject = SetShowPaintRectsReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowLayoutShiftRegions` command. | |
pub type SetShowLayoutShiftRegions = SetShowLayoutShiftRegionsRequest; | |
/// Return object of the `Overlay::setShowLayoutShiftRegions` command. | |
pub type SetShowLayoutShiftRegionsReturnObject = SetShowLayoutShiftRegionsResponse; | |
/// Request object of the `Overlay::setShowLayoutShiftRegions` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowLayoutShiftRegionsRequest { | |
/// True for showing layout shift regions | |
pub result: Boolean, | |
} | |
/// Response object of the `Overlay::setShowLayoutShiftRegions` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowLayoutShiftRegionsResponse { | |
} | |
impl Method for SetShowLayoutShiftRegions { | |
const NAME: &'static str = "Overlay.setShowLayoutShiftRegions"; | |
type ReturnObject = SetShowLayoutShiftRegionsReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowScrollBottleneckRects` command. | |
pub type SetShowScrollBottleneckRects = SetShowScrollBottleneckRectsRequest; | |
/// Return object of the `Overlay::setShowScrollBottleneckRects` command. | |
pub type SetShowScrollBottleneckRectsReturnObject = SetShowScrollBottleneckRectsResponse; | |
/// Request object of the `Overlay::setShowScrollBottleneckRects` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowScrollBottleneckRectsRequest { | |
/// True for showing scroll bottleneck rects | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowScrollBottleneckRects` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowScrollBottleneckRectsResponse { | |
} | |
impl Method for SetShowScrollBottleneckRects { | |
const NAME: &'static str = "Overlay.setShowScrollBottleneckRects"; | |
type ReturnObject = SetShowScrollBottleneckRectsReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowHitTestBorders` command. | |
pub type SetShowHitTestBorders = SetShowHitTestBordersRequest; | |
/// Return object of the `Overlay::setShowHitTestBorders` command. | |
pub type SetShowHitTestBordersReturnObject = SetShowHitTestBordersResponse; | |
/// Request object of the `Overlay::setShowHitTestBorders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowHitTestBordersRequest { | |
/// True for showing hit-test borders | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowHitTestBorders` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowHitTestBordersResponse { | |
} | |
impl Method for SetShowHitTestBorders { | |
const NAME: &'static str = "Overlay.setShowHitTestBorders"; | |
type ReturnObject = SetShowHitTestBordersReturnObject; | |
} | |
/// Method parameters of the `Overlay::setShowViewportSizeOnResize` command. | |
pub type SetShowViewportSizeOnResize = SetShowViewportSizeOnResizeRequest; | |
/// Return object of the `Overlay::setShowViewportSizeOnResize` command. | |
pub type SetShowViewportSizeOnResizeReturnObject = SetShowViewportSizeOnResizeResponse; | |
/// Request object of the `Overlay::setShowViewportSizeOnResize` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowViewportSizeOnResizeRequest { | |
/// Whether to paint size or not. | |
pub show: Boolean, | |
} | |
/// Response object of the `Overlay::setShowViewportSizeOnResize` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct SetShowViewportSizeOnResizeResponse { | |
} | |
impl Method for SetShowViewportSizeOnResize { | |
const NAME: &'static str = "Overlay.setShowViewportSizeOnResize"; | |
type ReturnObject = SetShowViewportSizeOnResizeReturnObject; | |
} | |
/// Fired when the node should be inspected. This happens after call to `setInspectMode` or when | |
/// user manually inspects an element. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InspectNodeRequestedEvent { | |
/// Id of the node to inspect. | |
pub backend_node_id: dom::BackendNodeId, | |
} | |
/// Fired when the node should be highlighted. This happens after call to `setInspectMode`. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NodeHighlightRequestedEvent { | |
pub node_id: dom::NodeId, | |
} | |
/// Fired when user asks to capture screenshot of some area on the page. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ScreenshotRequestedEvent { | |
/// Viewport to capture, in device independent pixels (dip). | |
pub viewport: page::Viewport, | |
} | |
/// Fired when user cancels the inspect mode. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct InspectModeCanceledEvent { | |
} | |
pub trait Events { | |
type Events: Iterator<Item = Event>; | |
fn events(&self) -> Self::Events; | |
} | |
#[cfg(feature = "async")] | |
pub trait AsyncEvents { | |
type Error; | |
type Events: futures::Stream<Item = Event, Error = Self::Error>; | |
fn events(&self) -> Self::Events; | |
} | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(tag = "method", content = "params")] | |
#[allow(clippy::large_enum_variant)] | |
pub enum Event { | |
/// Fired when the node should be inspected. This happens after call to `setInspectMode` or when | |
/// user manually inspects an element. | |
#[serde(rename = "Overlay.inspectNodeRequested")] | |
InspectNodeRequested(InspectNodeRequestedEvent), | |
/// Fired when the node should be highlighted. This happens after call to `setInspectMode`. | |
#[serde(rename = "Overlay.nodeHighlightRequested")] | |
NodeHighlightRequested(NodeHighlightRequestedEvent), | |
/// Fired when user asks to capture screenshot of some area on the page. | |
#[serde(rename = "Overlay.screenshotRequested")] | |
ScreenshotRequested(ScreenshotRequestedEvent), | |
/// Fired when user cancels the inspect mode. | |
#[serde(rename = "Overlay.inspectModeCanceled")] | |
InspectModeCanceled(InspectModeCanceledEvent), | |
} | |
} | |
/// Actions and events related to the inspected page belong to the page domain. | |
#[cfg(any(feature = "all", feature = "page"))] | |
pub trait Page: Debugger + DOM + IO + Network + Runtime { | |
type Error; | |
/// Deprecated, please use addScriptToEvaluateOnNewDocument instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn add_script_to_evaluate_on_load(&mut self, script_source: String) -> Result<(page::ScriptIdentifier), <Self as Page>::Error>; | |
/// Evaluates given script in every frame upon creation (before loading frame's scripts). | |
fn add_script_to_evaluate_on_new_document(&mut self, source: String, world_name: Option<String>) -> Result<(page::ScriptIdentifier), <Self as Page>::Error>; | |
/// Brings page to front (activates tab). | |
fn bring_to_front(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Capture page screenshot. | |
fn capture_screenshot(&mut self, format: Option<page::CaptureScreenshotRequestFormat>, quality: Option<Integer>, clip: Option<page::Viewport>, from_surface: Option<Boolean>) -> Result<(Binary), <Self as Page>::Error>; | |
/// Returns a snapshot of the page as a string. For MHTML format, the serialization includes | |
/// iframes, shadow DOM, external resources, and element-inline styles. | |
#[cfg(feature = "experimental")] | |
fn capture_snapshot(&mut self, format: Option<page::CaptureSnapshotRequestFormat>) -> Result<(String), <Self as Page>::Error>; | |
/// Clears the overriden device metrics. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn clear_device_metrics_override(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Clears the overridden Device Orientation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn clear_device_orientation_override(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Clears the overriden Geolocation Position and Error. | |
#[deprecated] | |
fn clear_geolocation_override(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Creates an isolated world for the given frame. | |
fn create_isolated_world(&mut self, frame_id: page::FrameId, world_name: Option<String>, grant_univeral_access: Option<Boolean>) -> Result<(runtime::ExecutionContextId), <Self as Page>::Error>; | |
/// Deletes browser cookie with given name, domain and path. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn delete_cookie(&mut self, cookie_name: String, url: String) -> Result<(), <Self as Page>::Error>; | |
/// Disables page domain notifications. | |
fn disable(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Enables page domain notifications. | |
fn enable(&mut self) -> Result<(), <Self as Page>::Error>; | |
fn get_app_manifest(&mut self) -> Result<(String, Vec<page::AppManifestError>, Option<String>), <Self as Page>::Error>; | |
#[cfg(feature = "experimental")] | |
fn get_installability_errors(&mut self) -> Result<(Vec<String>), <Self as Page>::Error>; | |
/// Returns all browser cookies. Depending on the backend support, will return detailed cookie | |
/// information in the `cookies` field. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn get_cookies(&mut self) -> Result<(Vec<network::Cookie>), <Self as Page>::Error>; | |
/// Returns present frame tree structure. | |
fn get_frame_tree(&mut self) -> Result<(page::FrameTree), <Self as Page>::Error>; | |
/// Returns metrics relating to the layouting of the page, such as viewport bounds/scale. | |
fn get_layout_metrics(&mut self) -> Result<(page::LayoutViewport, page::VisualViewport, dom::Rect), <Self as Page>::Error>; | |
/// Returns navigation history for the current page. | |
fn get_navigation_history(&mut self) -> Result<(Integer, Vec<page::NavigationEntry>), <Self as Page>::Error>; | |
/// Resets navigation history for the current page. | |
fn reset_navigation_history(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Returns content of the given resource. | |
#[cfg(feature = "experimental")] | |
fn get_resource_content(&mut self, frame_id: page::FrameId, url: String) -> Result<(String, Boolean), <Self as Page>::Error>; | |
/// Returns present frame / resource tree structure. | |
#[cfg(feature = "experimental")] | |
fn get_resource_tree(&mut self) -> Result<(page::FrameResourceTree), <Self as Page>::Error>; | |
/// Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). | |
fn handle_java_script_dialog(&mut self, accept: Boolean, prompt_text: Option<String>) -> Result<(), <Self as Page>::Error>; | |
/// Navigates current page to the given URL. | |
fn navigate(&mut self, url: String, referrer: Option<String>, transition_type: Option<page::TransitionType>, frame_id: Option<page::FrameId>) -> Result<(page::FrameId, Option<network::LoaderId>, Option<String>), <Self as Page>::Error>; | |
/// Navigates current page to the given history entry. | |
fn navigate_to_history_entry(&mut self, entry_id: Integer) -> Result<(), <Self as Page>::Error>; | |
/// Print page as PDF. | |
fn print_to_pdf(&mut self, req: page::PrintToPDFRequest) -> Result<(Binary, Option<io::StreamHandle>), <Self as Page>::Error>; | |
/// Reloads given page optionally ignoring the cache. | |
fn reload(&mut self, ignore_cache: Option<Boolean>, script_to_evaluate_on_load: Option<String>) -> Result<(), <Self as Page>::Error>; | |
/// Deprecated, please use removeScriptToEvaluateOnNewDocument instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn remove_script_to_evaluate_on_load(&mut self, identifier: page::ScriptIdentifier) -> Result<(), <Self as Page>::Error>; | |
/// Removes given script from the list. | |
fn remove_script_to_evaluate_on_new_document(&mut self, identifier: page::ScriptIdentifier) -> Result<(), <Self as Page>::Error>; | |
/// Acknowledges that a screencast frame has been received by the frontend. | |
#[cfg(feature = "experimental")] | |
fn screencast_frame_ack(&mut self, session_id: Integer) -> Result<(), <Self as Page>::Error>; | |
/// Searches for given string in resource content. | |
#[cfg(feature = "experimental")] | |
fn search_in_resource(&mut self, frame_id: page::FrameId, url: String, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> Result<(Vec<debugger::SearchMatch>), <Self as Page>::Error>; | |
/// Enable Chrome's experimental ad filter on all sites. | |
#[cfg(feature = "experimental")] | |
fn set_ad_blocking_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error>; | |
/// Enable page Content Security Policy by-passing. | |
#[cfg(feature = "experimental")] | |
fn set_bypass_csp(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error>; | |
/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height, | |
/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media | |
/// query results). | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_device_metrics_override(&mut self, req: page::SetDeviceMetricsOverrideRequest) -> Result<(), <Self as Page>::Error>; | |
/// Overrides the Device Orientation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_device_orientation_override(&mut self, alpha: Number, beta: Number, gamma: Number) -> Result<(), <Self as Page>::Error>; | |
/// Set generic font families. | |
#[cfg(feature = "experimental")] | |
fn set_font_families(&mut self, font_families: page::FontFamilies) -> Result<(), <Self as Page>::Error>; | |
/// Set default font sizes. | |
#[cfg(feature = "experimental")] | |
fn set_font_sizes(&mut self, font_sizes: page::FontSizes) -> Result<(), <Self as Page>::Error>; | |
/// Sets given markup as the document's HTML. | |
fn set_document_content(&mut self, frame_id: page::FrameId, html: String) -> Result<(), <Self as Page>::Error>; | |
/// Set the behavior when downloading a file. | |
#[cfg(feature = "experimental")] | |
fn set_download_behavior(&mut self, behavior: page::SetDownloadBehaviorRequestBehavior, download_path: Option<String>) -> Result<(), <Self as Page>::Error>; | |
/// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position | |
/// unavailable. | |
#[deprecated] | |
fn set_geolocation_override(&mut self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> Result<(), <Self as Page>::Error>; | |
/// Controls whether page will emit lifecycle events. | |
#[cfg(feature = "experimental")] | |
fn set_lifecycle_events_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error>; | |
/// Toggles mouse event-based touch event emulation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_touch_emulation_enabled(&mut self, enabled: Boolean, configuration: Option<page::SetTouchEmulationEnabledRequestConfiguration>) -> Result<(), <Self as Page>::Error>; | |
/// Starts sending each frame using the `screencastFrame` event. | |
#[cfg(feature = "experimental")] | |
fn start_screencast(&mut self, format: Option<page::StartScreencastRequestFormat>, quality: Option<Integer>, max_width: Option<Integer>, max_height: Option<Integer>, every_nth_frame: Option<Integer>) -> Result<(), <Self as Page>::Error>; | |
/// Force the page stop all navigations and pending resource fetches. | |
fn stop_loading(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Crashes renderer on the IO thread, generates minidumps. | |
#[cfg(feature = "experimental")] | |
fn crash(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Tries to close page, running its beforeunload hooks, if any. | |
#[cfg(feature = "experimental")] | |
fn close(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Tries to update the web lifecycle state of the page. | |
/// It will transition the page to the given state according to: | |
/// https://github.com/WICG/web-lifecycle/ | |
#[cfg(feature = "experimental")] | |
fn set_web_lifecycle_state(&mut self, state: page::SetWebLifecycleStateRequestState) -> Result<(), <Self as Page>::Error>; | |
/// Stops sending each frame in the `screencastFrame`. | |
#[cfg(feature = "experimental")] | |
fn stop_screencast(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Forces compilation cache to be generated for every subresource script. | |
#[cfg(feature = "experimental")] | |
fn set_produce_compilation_cache(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error>; | |
/// Seeds compilation cache for given url. Compilation cache does not survive | |
/// cross-process navigation. | |
#[cfg(feature = "experimental")] | |
fn add_compilation_cache(&mut self, url: String, data: Binary) -> Result<(), <Self as Page>::Error>; | |
/// Clears seeded compilation cache. | |
#[cfg(feature = "experimental")] | |
fn clear_compilation_cache(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Generates a report for testing. | |
#[cfg(feature = "experimental")] | |
fn generate_test_report(&mut self, message: String, group: Option<String>) -> Result<(), <Self as Page>::Error>; | |
/// Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger. | |
#[cfg(feature = "experimental")] | |
fn wait_for_debugger(&mut self) -> Result<(), <Self as Page>::Error>; | |
/// Intercept file chooser requests and transfer control to protocol clients. | |
/// When file chooser interception is enabled, native file chooser dialog is not shown. | |
/// Instead, a protocol event `Page.fileChooserOpened` is emitted. | |
/// File chooser can be handled with `page.handleFileChooser` command. | |
#[cfg(feature = "experimental")] | |
fn set_intercept_file_chooser_dialog(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error>; | |
/// Accepts or cancels an intercepted file chooser dialog. | |
#[cfg(feature = "experimental")] | |
fn handle_file_chooser(&mut self, action: page::HandleFileChooserRequestAction, files: Option<Vec<String>>) -> Result<(), <Self as Page>::Error>; | |
} | |
#[cfg(any(feature = "all", feature = "page"))] | |
impl<T> Page for T where T: CallSite { | |
type Error = <T as CallSite>::Error; | |
#[cfg(feature = "experimental")] | |
fn add_script_to_evaluate_on_load(&mut self, script_source: String) -> Result<(page::ScriptIdentifier), <Self as Page>::Error> { | |
CallSite::call(self, page::AddScriptToEvaluateOnLoadRequest { script_source }).map(|res| (res.identifier)) | |
} | |
fn add_script_to_evaluate_on_new_document(&mut self, source: String, world_name: Option<String>) -> Result<(page::ScriptIdentifier), <Self as Page>::Error> { | |
CallSite::call(self, page::AddScriptToEvaluateOnNewDocumentRequest { source, world_name }).map(|res| (res.identifier)) | |
} | |
fn bring_to_front(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::BringToFrontRequest {}).map(|_| ()) | |
} | |
fn capture_screenshot(&mut self, format: Option<page::CaptureScreenshotRequestFormat>, quality: Option<Integer>, clip: Option<page::Viewport>, from_surface: Option<Boolean>) -> Result<(Binary), <Self as Page>::Error> { | |
CallSite::call(self, page::CaptureScreenshotRequest { format, quality, clip, from_surface }).map(|res| (res.data)) | |
} | |
#[cfg(feature = "experimental")] | |
fn capture_snapshot(&mut self, format: Option<page::CaptureSnapshotRequestFormat>) -> Result<(String), <Self as Page>::Error> { | |
CallSite::call(self, page::CaptureSnapshotRequest { format }).map(|res| (res.data)) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_device_metrics_override(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ClearDeviceMetricsOverrideRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_device_orientation_override(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ClearDeviceOrientationOverrideRequest {}).map(|_| ()) | |
} | |
fn clear_geolocation_override(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ClearGeolocationOverrideRequest {}).map(|_| ()) | |
} | |
fn create_isolated_world(&mut self, frame_id: page::FrameId, world_name: Option<String>, grant_univeral_access: Option<Boolean>) -> Result<(runtime::ExecutionContextId), <Self as Page>::Error> { | |
CallSite::call(self, page::CreateIsolatedWorldRequest { frame_id, world_name, grant_univeral_access }).map(|res| (res.execution_context_id)) | |
} | |
#[cfg(feature = "experimental")] | |
fn delete_cookie(&mut self, cookie_name: String, url: String) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::DeleteCookieRequest { cookie_name, url }).map(|_| ()) | |
} | |
fn disable(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::DisableRequest {}).map(|_| ()) | |
} | |
fn enable(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::EnableRequest {}).map(|_| ()) | |
} | |
fn get_app_manifest(&mut self) -> Result<(String, Vec<page::AppManifestError>, Option<String>), <Self as Page>::Error> { | |
CallSite::call(self, page::GetAppManifestRequest {}).map(|res| (res.url, res.errors, res.data)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_installability_errors(&mut self) -> Result<(Vec<String>), <Self as Page>::Error> { | |
CallSite::call(self, page::GetInstallabilityErrorsRequest {}).map(|res| (res.errors)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_cookies(&mut self) -> Result<(Vec<network::Cookie>), <Self as Page>::Error> { | |
CallSite::call(self, page::GetCookiesRequest {}).map(|res| (res.cookies)) | |
} | |
fn get_frame_tree(&mut self) -> Result<(page::FrameTree), <Self as Page>::Error> { | |
CallSite::call(self, page::GetFrameTreeRequest {}).map(|res| (res.frame_tree)) | |
} | |
fn get_layout_metrics(&mut self) -> Result<(page::LayoutViewport, page::VisualViewport, dom::Rect), <Self as Page>::Error> { | |
CallSite::call(self, page::GetLayoutMetricsRequest {}).map(|res| (res.layout_viewport, res.visual_viewport, res.content_size)) | |
} | |
fn get_navigation_history(&mut self) -> Result<(Integer, Vec<page::NavigationEntry>), <Self as Page>::Error> { | |
CallSite::call(self, page::GetNavigationHistoryRequest {}).map(|res| (res.current_index, res.entries)) | |
} | |
fn reset_navigation_history(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ResetNavigationHistoryRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_resource_content(&mut self, frame_id: page::FrameId, url: String) -> Result<(String, Boolean), <Self as Page>::Error> { | |
CallSite::call(self, page::GetResourceContentRequest { frame_id, url }).map(|res| (res.content, res.base64_encoded)) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_resource_tree(&mut self) -> Result<(page::FrameResourceTree), <Self as Page>::Error> { | |
CallSite::call(self, page::GetResourceTreeRequest {}).map(|res| (res.frame_tree)) | |
} | |
fn handle_java_script_dialog(&mut self, accept: Boolean, prompt_text: Option<String>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::HandleJavaScriptDialogRequest { accept, prompt_text }).map(|_| ()) | |
} | |
fn navigate(&mut self, url: String, referrer: Option<String>, transition_type: Option<page::TransitionType>, frame_id: Option<page::FrameId>) -> Result<(page::FrameId, Option<network::LoaderId>, Option<String>), <Self as Page>::Error> { | |
CallSite::call(self, page::NavigateRequest { url, referrer, transition_type, frame_id }).map(|res| (res.frame_id, res.loader_id, res.error_text)) | |
} | |
fn navigate_to_history_entry(&mut self, entry_id: Integer) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::NavigateToHistoryEntryRequest { entry_id }).map(|_| ()) | |
} | |
fn print_to_pdf(&mut self, req: page::PrintToPDFRequest) -> Result<(Binary, Option<io::StreamHandle>), <Self as Page>::Error> { | |
CallSite::call(self, req).map(|res| (res.data, res.stream)) | |
} | |
fn reload(&mut self, ignore_cache: Option<Boolean>, script_to_evaluate_on_load: Option<String>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ReloadRequest { ignore_cache, script_to_evaluate_on_load }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn remove_script_to_evaluate_on_load(&mut self, identifier: page::ScriptIdentifier) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::RemoveScriptToEvaluateOnLoadRequest { identifier }).map(|_| ()) | |
} | |
fn remove_script_to_evaluate_on_new_document(&mut self, identifier: page::ScriptIdentifier) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::RemoveScriptToEvaluateOnNewDocumentRequest { identifier }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn screencast_frame_ack(&mut self, session_id: Integer) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ScreencastFrameAckRequest { session_id }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn search_in_resource(&mut self, frame_id: page::FrameId, url: String, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> Result<(Vec<debugger::SearchMatch>), <Self as Page>::Error> { | |
CallSite::call(self, page::SearchInResourceRequest { frame_id, url, query, case_sensitive, is_regex }).map(|res| (res.result)) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_ad_blocking_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetAdBlockingEnabledRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_bypass_csp(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetBypassCSPRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_device_metrics_override(&mut self, req: page::SetDeviceMetricsOverrideRequest) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, req).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_device_orientation_override(&mut self, alpha: Number, beta: Number, gamma: Number) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetDeviceOrientationOverrideRequest { alpha, beta, gamma }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_font_families(&mut self, font_families: page::FontFamilies) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetFontFamiliesRequest { font_families }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_font_sizes(&mut self, font_sizes: page::FontSizes) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetFontSizesRequest { font_sizes }).map(|_| ()) | |
} | |
fn set_document_content(&mut self, frame_id: page::FrameId, html: String) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetDocumentContentRequest { frame_id, html }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_download_behavior(&mut self, behavior: page::SetDownloadBehaviorRequestBehavior, download_path: Option<String>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetDownloadBehaviorRequest { behavior, download_path }).map(|_| ()) | |
} | |
fn set_geolocation_override(&mut self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetGeolocationOverrideRequest { latitude, longitude, accuracy }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_lifecycle_events_enabled(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetLifecycleEventsEnabledRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_touch_emulation_enabled(&mut self, enabled: Boolean, configuration: Option<page::SetTouchEmulationEnabledRequestConfiguration>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetTouchEmulationEnabledRequest { enabled, configuration }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn start_screencast(&mut self, format: Option<page::StartScreencastRequestFormat>, quality: Option<Integer>, max_width: Option<Integer>, max_height: Option<Integer>, every_nth_frame: Option<Integer>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::StartScreencastRequest { format, quality, max_width, max_height, every_nth_frame }).map(|_| ()) | |
} | |
fn stop_loading(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::StopLoadingRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::CrashRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn close(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::CloseRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_web_lifecycle_state(&mut self, state: page::SetWebLifecycleStateRequestState) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetWebLifecycleStateRequest { state }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn stop_screencast(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::StopScreencastRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_produce_compilation_cache(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetProduceCompilationCacheRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn add_compilation_cache(&mut self, url: String, data: Binary) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::AddCompilationCacheRequest { url, data }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_compilation_cache(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::ClearCompilationCacheRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn generate_test_report(&mut self, message: String, group: Option<String>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::GenerateTestReportRequest { message, group }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn wait_for_debugger(&mut self) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::WaitForDebuggerRequest {}).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_intercept_file_chooser_dialog(&mut self, enabled: Boolean) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::SetInterceptFileChooserDialogRequest { enabled }).map(|_| ()) | |
} | |
#[cfg(feature = "experimental")] | |
fn handle_file_chooser(&mut self, action: page::HandleFileChooserRequestAction, files: Option<Vec<String>>) -> Result<(), <Self as Page>::Error> { | |
CallSite::call(self, page::HandleFileChooserRequest { action, files }).map(|_| ()) | |
} | |
} | |
/// Actions and events related to the inspected page belong to the page domain. | |
#[cfg(all(feature = "async", any(feature = "all", feature = "page")))] | |
pub trait AsyncPage: AsyncDebugger + AsyncDOM + AsyncIO + AsyncNetwork + AsyncRuntime where Self: Sized { | |
type Error; | |
#[cfg(feature = "experimental")] | |
type AddScriptToEvaluateOnLoad: futures::Future<Item = ((page::ScriptIdentifier), Self), Error = <Self as AsyncPage>::Error>; | |
type AddScriptToEvaluateOnNewDocument: futures::Future<Item = ((page::ScriptIdentifier), Self), Error = <Self as AsyncPage>::Error>; | |
type BringToFront: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type CaptureScreenshot: futures::Future<Item = ((Binary), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type CaptureSnapshot: futures::Future<Item = ((String), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type ClearDeviceMetricsOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type ClearDeviceOrientationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type ClearGeolocationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type CreateIsolatedWorld: futures::Future<Item = ((runtime::ExecutionContextId), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type DeleteCookie: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type Disable: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type Enable: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type GetAppManifest: futures::Future<Item = ((String, Vec<page::AppManifestError>, Option<String>), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetInstallabilityErrors: futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetCookies: futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncPage>::Error>; | |
type GetFrameTree: futures::Future<Item = ((page::FrameTree), Self), Error = <Self as AsyncPage>::Error>; | |
type GetLayoutMetrics: futures::Future<Item = ((page::LayoutViewport, page::VisualViewport, dom::Rect), Self), Error = <Self as AsyncPage>::Error>; | |
type GetNavigationHistory: futures::Future<Item = ((Integer, Vec<page::NavigationEntry>), Self), Error = <Self as AsyncPage>::Error>; | |
type ResetNavigationHistory: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetResourceContent: futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type GetResourceTree: futures::Future<Item = ((page::FrameResourceTree), Self), Error = <Self as AsyncPage>::Error>; | |
type HandleJavaScriptDialog: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type Navigate: futures::Future<Item = ((page::FrameId, Option<network::LoaderId>, Option<String>), Self), Error = <Self as AsyncPage>::Error>; | |
type NavigateToHistoryEntry: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type PrintToPDF: futures::Future<Item = ((Binary, Option<io::StreamHandle>), Self), Error = <Self as AsyncPage>::Error>; | |
type Reload: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type RemoveScriptToEvaluateOnLoad: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type RemoveScriptToEvaluateOnNewDocument: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type ScreencastFrameAck: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SearchInResource: futures::Future<Item = ((Vec<debugger::SearchMatch>), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetAdBlockingEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetBypassCSP: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDeviceMetricsOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDeviceOrientationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetFontFamilies: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetFontSizes: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type SetDocumentContent: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetDownloadBehavior: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type SetGeolocationOverride: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetLifecycleEventsEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetTouchEmulationEnabled: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type StartScreencast: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
type StopLoading: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type Crash: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type Close: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetWebLifecycleState: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type StopScreencast: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetProduceCompilationCache: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type AddCompilationCache: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type ClearCompilationCache: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type GenerateTestReport: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type WaitForDebugger: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type SetInterceptFileChooserDialog: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
#[cfg(feature = "experimental")] | |
type HandleFileChooser: futures::Future<Item = ((), Self), Error = <Self as AsyncPage>::Error>; | |
/// Deprecated, please use addScriptToEvaluateOnNewDocument instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn add_script_to_evaluate_on_load(self, script_source: String) -> <Self as AsyncPage>::AddScriptToEvaluateOnLoad; | |
/// Evaluates given script in every frame upon creation (before loading frame's scripts). | |
fn add_script_to_evaluate_on_new_document(self, source: String, world_name: Option<String>) -> <Self as AsyncPage>::AddScriptToEvaluateOnNewDocument; | |
/// Brings page to front (activates tab). | |
fn bring_to_front(self) -> <Self as AsyncPage>::BringToFront; | |
/// Capture page screenshot. | |
fn capture_screenshot(self, format: Option<page::CaptureScreenshotRequestFormat>, quality: Option<Integer>, clip: Option<page::Viewport>, from_surface: Option<Boolean>) -> <Self as AsyncPage>::CaptureScreenshot; | |
/// Returns a snapshot of the page as a string. For MHTML format, the serialization includes | |
/// iframes, shadow DOM, external resources, and element-inline styles. | |
#[cfg(feature = "experimental")] | |
fn capture_snapshot(self, format: Option<page::CaptureSnapshotRequestFormat>) -> <Self as AsyncPage>::CaptureSnapshot; | |
/// Clears the overriden device metrics. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn clear_device_metrics_override(self) -> <Self as AsyncPage>::ClearDeviceMetricsOverride; | |
/// Clears the overridden Device Orientation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn clear_device_orientation_override(self) -> <Self as AsyncPage>::ClearDeviceOrientationOverride; | |
/// Clears the overriden Geolocation Position and Error. | |
#[deprecated] | |
fn clear_geolocation_override(self) -> <Self as AsyncPage>::ClearGeolocationOverride; | |
/// Creates an isolated world for the given frame. | |
fn create_isolated_world(self, frame_id: page::FrameId, world_name: Option<String>, grant_univeral_access: Option<Boolean>) -> <Self as AsyncPage>::CreateIsolatedWorld; | |
/// Deletes browser cookie with given name, domain and path. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn delete_cookie(self, cookie_name: String, url: String) -> <Self as AsyncPage>::DeleteCookie; | |
/// Disables page domain notifications. | |
fn disable(self) -> <Self as AsyncPage>::Disable; | |
/// Enables page domain notifications. | |
fn enable(self) -> <Self as AsyncPage>::Enable; | |
fn get_app_manifest(self) -> <Self as AsyncPage>::GetAppManifest; | |
#[cfg(feature = "experimental")] | |
fn get_installability_errors(self) -> <Self as AsyncPage>::GetInstallabilityErrors; | |
/// Returns all browser cookies. Depending on the backend support, will return detailed cookie | |
/// information in the `cookies` field. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn get_cookies(self) -> <Self as AsyncPage>::GetCookies; | |
/// Returns present frame tree structure. | |
fn get_frame_tree(self) -> <Self as AsyncPage>::GetFrameTree; | |
/// Returns metrics relating to the layouting of the page, such as viewport bounds/scale. | |
fn get_layout_metrics(self) -> <Self as AsyncPage>::GetLayoutMetrics; | |
/// Returns navigation history for the current page. | |
fn get_navigation_history(self) -> <Self as AsyncPage>::GetNavigationHistory; | |
/// Resets navigation history for the current page. | |
fn reset_navigation_history(self) -> <Self as AsyncPage>::ResetNavigationHistory; | |
/// Returns content of the given resource. | |
#[cfg(feature = "experimental")] | |
fn get_resource_content(self, frame_id: page::FrameId, url: String) -> <Self as AsyncPage>::GetResourceContent; | |
/// Returns present frame / resource tree structure. | |
#[cfg(feature = "experimental")] | |
fn get_resource_tree(self) -> <Self as AsyncPage>::GetResourceTree; | |
/// Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). | |
fn handle_java_script_dialog(self, accept: Boolean, prompt_text: Option<String>) -> <Self as AsyncPage>::HandleJavaScriptDialog; | |
/// Navigates current page to the given URL. | |
fn navigate(self, url: String, referrer: Option<String>, transition_type: Option<page::TransitionType>, frame_id: Option<page::FrameId>) -> <Self as AsyncPage>::Navigate; | |
/// Navigates current page to the given history entry. | |
fn navigate_to_history_entry(self, entry_id: Integer) -> <Self as AsyncPage>::NavigateToHistoryEntry; | |
/// Print page as PDF. | |
fn print_to_pdf(self, req: page::PrintToPDFRequest) -> <Self as AsyncPage>::PrintToPDF; | |
/// Reloads given page optionally ignoring the cache. | |
fn reload(self, ignore_cache: Option<Boolean>, script_to_evaluate_on_load: Option<String>) -> <Self as AsyncPage>::Reload; | |
/// Deprecated, please use removeScriptToEvaluateOnNewDocument instead. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn remove_script_to_evaluate_on_load(self, identifier: page::ScriptIdentifier) -> <Self as AsyncPage>::RemoveScriptToEvaluateOnLoad; | |
/// Removes given script from the list. | |
fn remove_script_to_evaluate_on_new_document(self, identifier: page::ScriptIdentifier) -> <Self as AsyncPage>::RemoveScriptToEvaluateOnNewDocument; | |
/// Acknowledges that a screencast frame has been received by the frontend. | |
#[cfg(feature = "experimental")] | |
fn screencast_frame_ack(self, session_id: Integer) -> <Self as AsyncPage>::ScreencastFrameAck; | |
/// Searches for given string in resource content. | |
#[cfg(feature = "experimental")] | |
fn search_in_resource(self, frame_id: page::FrameId, url: String, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> <Self as AsyncPage>::SearchInResource; | |
/// Enable Chrome's experimental ad filter on all sites. | |
#[cfg(feature = "experimental")] | |
fn set_ad_blocking_enabled(self, enabled: Boolean) -> <Self as AsyncPage>::SetAdBlockingEnabled; | |
/// Enable page Content Security Policy by-passing. | |
#[cfg(feature = "experimental")] | |
fn set_bypass_csp(self, enabled: Boolean) -> <Self as AsyncPage>::SetBypassCSP; | |
/// Overrides the values of device screen dimensions (window.screen.width, window.screen.height, | |
/// window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media | |
/// query results). | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_device_metrics_override(self, req: page::SetDeviceMetricsOverrideRequest) -> <Self as AsyncPage>::SetDeviceMetricsOverride; | |
/// Overrides the Device Orientation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_device_orientation_override(self, alpha: Number, beta: Number, gamma: Number) -> <Self as AsyncPage>::SetDeviceOrientationOverride; | |
/// Set generic font families. | |
#[cfg(feature = "experimental")] | |
fn set_font_families(self, font_families: page::FontFamilies) -> <Self as AsyncPage>::SetFontFamilies; | |
/// Set default font sizes. | |
#[cfg(feature = "experimental")] | |
fn set_font_sizes(self, font_sizes: page::FontSizes) -> <Self as AsyncPage>::SetFontSizes; | |
/// Sets given markup as the document's HTML. | |
fn set_document_content(self, frame_id: page::FrameId, html: String) -> <Self as AsyncPage>::SetDocumentContent; | |
/// Set the behavior when downloading a file. | |
#[cfg(feature = "experimental")] | |
fn set_download_behavior(self, behavior: page::SetDownloadBehaviorRequestBehavior, download_path: Option<String>) -> <Self as AsyncPage>::SetDownloadBehavior; | |
/// Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position | |
/// unavailable. | |
#[deprecated] | |
fn set_geolocation_override(self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> <Self as AsyncPage>::SetGeolocationOverride; | |
/// Controls whether page will emit lifecycle events. | |
#[cfg(feature = "experimental")] | |
fn set_lifecycle_events_enabled(self, enabled: Boolean) -> <Self as AsyncPage>::SetLifecycleEventsEnabled; | |
/// Toggles mouse event-based touch event emulation. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
fn set_touch_emulation_enabled(self, enabled: Boolean, configuration: Option<page::SetTouchEmulationEnabledRequestConfiguration>) -> <Self as AsyncPage>::SetTouchEmulationEnabled; | |
/// Starts sending each frame using the `screencastFrame` event. | |
#[cfg(feature = "experimental")] | |
fn start_screencast(self, format: Option<page::StartScreencastRequestFormat>, quality: Option<Integer>, max_width: Option<Integer>, max_height: Option<Integer>, every_nth_frame: Option<Integer>) -> <Self as AsyncPage>::StartScreencast; | |
/// Force the page stop all navigations and pending resource fetches. | |
fn stop_loading(self) -> <Self as AsyncPage>::StopLoading; | |
/// Crashes renderer on the IO thread, generates minidumps. | |
#[cfg(feature = "experimental")] | |
fn crash(self) -> <Self as AsyncPage>::Crash; | |
/// Tries to close page, running its beforeunload hooks, if any. | |
#[cfg(feature = "experimental")] | |
fn close(self) -> <Self as AsyncPage>::Close; | |
/// Tries to update the web lifecycle state of the page. | |
/// It will transition the page to the given state according to: | |
/// https://github.com/WICG/web-lifecycle/ | |
#[cfg(feature = "experimental")] | |
fn set_web_lifecycle_state(self, state: page::SetWebLifecycleStateRequestState) -> <Self as AsyncPage>::SetWebLifecycleState; | |
/// Stops sending each frame in the `screencastFrame`. | |
#[cfg(feature = "experimental")] | |
fn stop_screencast(self) -> <Self as AsyncPage>::StopScreencast; | |
/// Forces compilation cache to be generated for every subresource script. | |
#[cfg(feature = "experimental")] | |
fn set_produce_compilation_cache(self, enabled: Boolean) -> <Self as AsyncPage>::SetProduceCompilationCache; | |
/// Seeds compilation cache for given url. Compilation cache does not survive | |
/// cross-process navigation. | |
#[cfg(feature = "experimental")] | |
fn add_compilation_cache(self, url: String, data: Binary) -> <Self as AsyncPage>::AddCompilationCache; | |
/// Clears seeded compilation cache. | |
#[cfg(feature = "experimental")] | |
fn clear_compilation_cache(self) -> <Self as AsyncPage>::ClearCompilationCache; | |
/// Generates a report for testing. | |
#[cfg(feature = "experimental")] | |
fn generate_test_report(self, message: String, group: Option<String>) -> <Self as AsyncPage>::GenerateTestReport; | |
/// Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger. | |
#[cfg(feature = "experimental")] | |
fn wait_for_debugger(self) -> <Self as AsyncPage>::WaitForDebugger; | |
/// Intercept file chooser requests and transfer control to protocol clients. | |
/// When file chooser interception is enabled, native file chooser dialog is not shown. | |
/// Instead, a protocol event `Page.fileChooserOpened` is emitted. | |
/// File chooser can be handled with `page.handleFileChooser` command. | |
#[cfg(feature = "experimental")] | |
fn set_intercept_file_chooser_dialog(self, enabled: Boolean) -> <Self as AsyncPage>::SetInterceptFileChooserDialog; | |
/// Accepts or cancels an intercepted file chooser dialog. | |
#[cfg(feature = "experimental")] | |
fn handle_file_chooser(self, action: page::HandleFileChooserRequestAction, files: Option<Vec<String>>) -> <Self as AsyncPage>::HandleFileChooser; | |
} | |
#[cfg(all(feature = "async", any(feature = "all", feature = "page")))] | |
impl<T> AsyncPage for T | |
where | |
T: AsyncCallSite + 'static, | |
<T as AsyncCallSite>::Error: 'static, | |
{ | |
type Error = <T as AsyncCallSite>::Error; | |
#[cfg(feature = "experimental")] | |
type AddScriptToEvaluateOnLoad = Box<dyn futures::Future<Item = ((page::ScriptIdentifier), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type AddScriptToEvaluateOnNewDocument = Box<dyn futures::Future<Item = ((page::ScriptIdentifier), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type BringToFront = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CaptureScreenshot = Box<dyn futures::Future<Item = ((Binary), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type CaptureSnapshot = Box<dyn futures::Future<Item = ((String), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ClearDeviceMetricsOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ClearDeviceOrientationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ClearGeolocationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type CreateIsolatedWorld = Box<dyn futures::Future<Item = ((runtime::ExecutionContextId), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type DeleteCookie = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Disable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Enable = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetAppManifest = Box<dyn futures::Future<Item = ((String, Vec<page::AppManifestError>, Option<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetInstallabilityErrors = Box<dyn futures::Future<Item = ((Vec<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetCookies = Box<dyn futures::Future<Item = ((Vec<network::Cookie>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetFrameTree = Box<dyn futures::Future<Item = ((page::FrameTree), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetLayoutMetrics = Box<dyn futures::Future<Item = ((page::LayoutViewport, page::VisualViewport, dom::Rect), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type GetNavigationHistory = Box<dyn futures::Future<Item = ((Integer, Vec<page::NavigationEntry>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type ResetNavigationHistory = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetResourceContent = Box<dyn futures::Future<Item = ((String, Boolean), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GetResourceTree = Box<dyn futures::Future<Item = ((page::FrameResourceTree), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type HandleJavaScriptDialog = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Navigate = Box<dyn futures::Future<Item = ((page::FrameId, Option<network::LoaderId>, Option<String>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type NavigateToHistoryEntry = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type PrintToPDF = Box<dyn futures::Future<Item = ((Binary, Option<io::StreamHandle>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type Reload = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type RemoveScriptToEvaluateOnLoad = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type RemoveScriptToEvaluateOnNewDocument = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ScreencastFrameAck = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SearchInResource = Box<dyn futures::Future<Item = ((Vec<debugger::SearchMatch>), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetAdBlockingEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetBypassCSP = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDeviceMetricsOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDeviceOrientationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetFontFamilies = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetFontSizes = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetDocumentContent = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetDownloadBehavior = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type SetGeolocationOverride = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetLifecycleEventsEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetTouchEmulationEnabled = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type StartScreencast = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
type StopLoading = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type Crash = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type Close = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetWebLifecycleState = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type StopScreencast = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetProduceCompilationCache = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type AddCompilationCache = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type ClearCompilationCache = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type GenerateTestReport = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type WaitForDebugger = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type SetInterceptFileChooserDialog = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
type HandleFileChooser = Box<dyn futures::Future<Item = ((), Self), Error = <Self as AsyncCallSite>::Error> + Send>; | |
#[cfg(feature = "experimental")] | |
fn add_script_to_evaluate_on_load(self, script_source: String) -> <Self as AsyncPage>::AddScriptToEvaluateOnLoad { | |
Box::new(AsyncCallSite::async_call(self, page::AddScriptToEvaluateOnLoadRequest { script_source }).map(|(res, self_)| ((res.identifier), self_))) | |
} | |
fn add_script_to_evaluate_on_new_document(self, source: String, world_name: Option<String>) -> <Self as AsyncPage>::AddScriptToEvaluateOnNewDocument { | |
Box::new(AsyncCallSite::async_call(self, page::AddScriptToEvaluateOnNewDocumentRequest { source, world_name }).map(|(res, self_)| ((res.identifier), self_))) | |
} | |
fn bring_to_front(self) -> <Self as AsyncPage>::BringToFront { | |
Box::new(AsyncCallSite::async_call(self, page::BringToFrontRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn capture_screenshot(self, format: Option<page::CaptureScreenshotRequestFormat>, quality: Option<Integer>, clip: Option<page::Viewport>, from_surface: Option<Boolean>) -> <Self as AsyncPage>::CaptureScreenshot { | |
Box::new(AsyncCallSite::async_call(self, page::CaptureScreenshotRequest { format, quality, clip, from_surface }).map(|(res, self_)| ((res.data), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn capture_snapshot(self, format: Option<page::CaptureSnapshotRequestFormat>) -> <Self as AsyncPage>::CaptureSnapshot { | |
Box::new(AsyncCallSite::async_call(self, page::CaptureSnapshotRequest { format }).map(|(res, self_)| ((res.data), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_device_metrics_override(self) -> <Self as AsyncPage>::ClearDeviceMetricsOverride { | |
Box::new(AsyncCallSite::async_call(self, page::ClearDeviceMetricsOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_device_orientation_override(self) -> <Self as AsyncPage>::ClearDeviceOrientationOverride { | |
Box::new(AsyncCallSite::async_call(self, page::ClearDeviceOrientationOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn clear_geolocation_override(self) -> <Self as AsyncPage>::ClearGeolocationOverride { | |
Box::new(AsyncCallSite::async_call(self, page::ClearGeolocationOverrideRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn create_isolated_world(self, frame_id: page::FrameId, world_name: Option<String>, grant_univeral_access: Option<Boolean>) -> <Self as AsyncPage>::CreateIsolatedWorld { | |
Box::new(AsyncCallSite::async_call(self, page::CreateIsolatedWorldRequest { frame_id, world_name, grant_univeral_access }).map(|(res, self_)| ((res.execution_context_id), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn delete_cookie(self, cookie_name: String, url: String) -> <Self as AsyncPage>::DeleteCookie { | |
Box::new(AsyncCallSite::async_call(self, page::DeleteCookieRequest { cookie_name, url }).map(|(_, self_)| ((), self_))) | |
} | |
fn disable(self) -> <Self as AsyncPage>::Disable { | |
Box::new(AsyncCallSite::async_call(self, page::DisableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn enable(self) -> <Self as AsyncPage>::Enable { | |
Box::new(AsyncCallSite::async_call(self, page::EnableRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
fn get_app_manifest(self) -> <Self as AsyncPage>::GetAppManifest { | |
Box::new(AsyncCallSite::async_call(self, page::GetAppManifestRequest {}).map(|(res, self_)| ((res.url, res.errors, res.data), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_installability_errors(self) -> <Self as AsyncPage>::GetInstallabilityErrors { | |
Box::new(AsyncCallSite::async_call(self, page::GetInstallabilityErrorsRequest {}).map(|(res, self_)| ((res.errors), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_cookies(self) -> <Self as AsyncPage>::GetCookies { | |
Box::new(AsyncCallSite::async_call(self, page::GetCookiesRequest {}).map(|(res, self_)| ((res.cookies), self_))) | |
} | |
fn get_frame_tree(self) -> <Self as AsyncPage>::GetFrameTree { | |
Box::new(AsyncCallSite::async_call(self, page::GetFrameTreeRequest {}).map(|(res, self_)| ((res.frame_tree), self_))) | |
} | |
fn get_layout_metrics(self) -> <Self as AsyncPage>::GetLayoutMetrics { | |
Box::new(AsyncCallSite::async_call(self, page::GetLayoutMetricsRequest {}).map(|(res, self_)| ((res.layout_viewport, res.visual_viewport, res.content_size), self_))) | |
} | |
fn get_navigation_history(self) -> <Self as AsyncPage>::GetNavigationHistory { | |
Box::new(AsyncCallSite::async_call(self, page::GetNavigationHistoryRequest {}).map(|(res, self_)| ((res.current_index, res.entries), self_))) | |
} | |
fn reset_navigation_history(self) -> <Self as AsyncPage>::ResetNavigationHistory { | |
Box::new(AsyncCallSite::async_call(self, page::ResetNavigationHistoryRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_resource_content(self, frame_id: page::FrameId, url: String) -> <Self as AsyncPage>::GetResourceContent { | |
Box::new(AsyncCallSite::async_call(self, page::GetResourceContentRequest { frame_id, url }).map(|(res, self_)| ((res.content, res.base64_encoded), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn get_resource_tree(self) -> <Self as AsyncPage>::GetResourceTree { | |
Box::new(AsyncCallSite::async_call(self, page::GetResourceTreeRequest {}).map(|(res, self_)| ((res.frame_tree), self_))) | |
} | |
fn handle_java_script_dialog(self, accept: Boolean, prompt_text: Option<String>) -> <Self as AsyncPage>::HandleJavaScriptDialog { | |
Box::new(AsyncCallSite::async_call(self, page::HandleJavaScriptDialogRequest { accept, prompt_text }).map(|(_, self_)| ((), self_))) | |
} | |
fn navigate(self, url: String, referrer: Option<String>, transition_type: Option<page::TransitionType>, frame_id: Option<page::FrameId>) -> <Self as AsyncPage>::Navigate { | |
Box::new(AsyncCallSite::async_call(self, page::NavigateRequest { url, referrer, transition_type, frame_id }).map(|(res, self_)| ((res.frame_id, res.loader_id, res.error_text), self_))) | |
} | |
fn navigate_to_history_entry(self, entry_id: Integer) -> <Self as AsyncPage>::NavigateToHistoryEntry { | |
Box::new(AsyncCallSite::async_call(self, page::NavigateToHistoryEntryRequest { entry_id }).map(|(_, self_)| ((), self_))) | |
} | |
fn print_to_pdf(self, req: page::PrintToPDFRequest) -> <Self as AsyncPage>::PrintToPDF { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(res, self_)| ((res.data, res.stream), self_))) | |
} | |
fn reload(self, ignore_cache: Option<Boolean>, script_to_evaluate_on_load: Option<String>) -> <Self as AsyncPage>::Reload { | |
Box::new(AsyncCallSite::async_call(self, page::ReloadRequest { ignore_cache, script_to_evaluate_on_load }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn remove_script_to_evaluate_on_load(self, identifier: page::ScriptIdentifier) -> <Self as AsyncPage>::RemoveScriptToEvaluateOnLoad { | |
Box::new(AsyncCallSite::async_call(self, page::RemoveScriptToEvaluateOnLoadRequest { identifier }).map(|(_, self_)| ((), self_))) | |
} | |
fn remove_script_to_evaluate_on_new_document(self, identifier: page::ScriptIdentifier) -> <Self as AsyncPage>::RemoveScriptToEvaluateOnNewDocument { | |
Box::new(AsyncCallSite::async_call(self, page::RemoveScriptToEvaluateOnNewDocumentRequest { identifier }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn screencast_frame_ack(self, session_id: Integer) -> <Self as AsyncPage>::ScreencastFrameAck { | |
Box::new(AsyncCallSite::async_call(self, page::ScreencastFrameAckRequest { session_id }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn search_in_resource(self, frame_id: page::FrameId, url: String, query: String, case_sensitive: Option<Boolean>, is_regex: Option<Boolean>) -> <Self as AsyncPage>::SearchInResource { | |
Box::new(AsyncCallSite::async_call(self, page::SearchInResourceRequest { frame_id, url, query, case_sensitive, is_regex }).map(|(res, self_)| ((res.result), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_ad_blocking_enabled(self, enabled: Boolean) -> <Self as AsyncPage>::SetAdBlockingEnabled { | |
Box::new(AsyncCallSite::async_call(self, page::SetAdBlockingEnabledRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_bypass_csp(self, enabled: Boolean) -> <Self as AsyncPage>::SetBypassCSP { | |
Box::new(AsyncCallSite::async_call(self, page::SetBypassCSPRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_device_metrics_override(self, req: page::SetDeviceMetricsOverrideRequest) -> <Self as AsyncPage>::SetDeviceMetricsOverride { | |
Box::new(AsyncCallSite::async_call(self, req).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_device_orientation_override(self, alpha: Number, beta: Number, gamma: Number) -> <Self as AsyncPage>::SetDeviceOrientationOverride { | |
Box::new(AsyncCallSite::async_call(self, page::SetDeviceOrientationOverrideRequest { alpha, beta, gamma }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_font_families(self, font_families: page::FontFamilies) -> <Self as AsyncPage>::SetFontFamilies { | |
Box::new(AsyncCallSite::async_call(self, page::SetFontFamiliesRequest { font_families }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_font_sizes(self, font_sizes: page::FontSizes) -> <Self as AsyncPage>::SetFontSizes { | |
Box::new(AsyncCallSite::async_call(self, page::SetFontSizesRequest { font_sizes }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_document_content(self, frame_id: page::FrameId, html: String) -> <Self as AsyncPage>::SetDocumentContent { | |
Box::new(AsyncCallSite::async_call(self, page::SetDocumentContentRequest { frame_id, html }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_download_behavior(self, behavior: page::SetDownloadBehaviorRequestBehavior, download_path: Option<String>) -> <Self as AsyncPage>::SetDownloadBehavior { | |
Box::new(AsyncCallSite::async_call(self, page::SetDownloadBehaviorRequest { behavior, download_path }).map(|(_, self_)| ((), self_))) | |
} | |
fn set_geolocation_override(self, latitude: Option<Number>, longitude: Option<Number>, accuracy: Option<Number>) -> <Self as AsyncPage>::SetGeolocationOverride { | |
Box::new(AsyncCallSite::async_call(self, page::SetGeolocationOverrideRequest { latitude, longitude, accuracy }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_lifecycle_events_enabled(self, enabled: Boolean) -> <Self as AsyncPage>::SetLifecycleEventsEnabled { | |
Box::new(AsyncCallSite::async_call(self, page::SetLifecycleEventsEnabledRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_touch_emulation_enabled(self, enabled: Boolean, configuration: Option<page::SetTouchEmulationEnabledRequestConfiguration>) -> <Self as AsyncPage>::SetTouchEmulationEnabled { | |
Box::new(AsyncCallSite::async_call(self, page::SetTouchEmulationEnabledRequest { enabled, configuration }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn start_screencast(self, format: Option<page::StartScreencastRequestFormat>, quality: Option<Integer>, max_width: Option<Integer>, max_height: Option<Integer>, every_nth_frame: Option<Integer>) -> <Self as AsyncPage>::StartScreencast { | |
Box::new(AsyncCallSite::async_call(self, page::StartScreencastRequest { format, quality, max_width, max_height, every_nth_frame }).map(|(_, self_)| ((), self_))) | |
} | |
fn stop_loading(self) -> <Self as AsyncPage>::StopLoading { | |
Box::new(AsyncCallSite::async_call(self, page::StopLoadingRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn crash(self) -> <Self as AsyncPage>::Crash { | |
Box::new(AsyncCallSite::async_call(self, page::CrashRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn close(self) -> <Self as AsyncPage>::Close { | |
Box::new(AsyncCallSite::async_call(self, page::CloseRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_web_lifecycle_state(self, state: page::SetWebLifecycleStateRequestState) -> <Self as AsyncPage>::SetWebLifecycleState { | |
Box::new(AsyncCallSite::async_call(self, page::SetWebLifecycleStateRequest { state }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn stop_screencast(self) -> <Self as AsyncPage>::StopScreencast { | |
Box::new(AsyncCallSite::async_call(self, page::StopScreencastRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_produce_compilation_cache(self, enabled: Boolean) -> <Self as AsyncPage>::SetProduceCompilationCache { | |
Box::new(AsyncCallSite::async_call(self, page::SetProduceCompilationCacheRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn add_compilation_cache(self, url: String, data: Binary) -> <Self as AsyncPage>::AddCompilationCache { | |
Box::new(AsyncCallSite::async_call(self, page::AddCompilationCacheRequest { url, data }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn clear_compilation_cache(self) -> <Self as AsyncPage>::ClearCompilationCache { | |
Box::new(AsyncCallSite::async_call(self, page::ClearCompilationCacheRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn generate_test_report(self, message: String, group: Option<String>) -> <Self as AsyncPage>::GenerateTestReport { | |
Box::new(AsyncCallSite::async_call(self, page::GenerateTestReportRequest { message, group }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn wait_for_debugger(self) -> <Self as AsyncPage>::WaitForDebugger { | |
Box::new(AsyncCallSite::async_call(self, page::WaitForDebuggerRequest {}).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn set_intercept_file_chooser_dialog(self, enabled: Boolean) -> <Self as AsyncPage>::SetInterceptFileChooserDialog { | |
Box::new(AsyncCallSite::async_call(self, page::SetInterceptFileChooserDialogRequest { enabled }).map(|(_, self_)| ((), self_))) | |
} | |
#[cfg(feature = "experimental")] | |
fn handle_file_chooser(self, action: page::HandleFileChooserRequestAction, files: Option<Vec<String>>) -> <Self as AsyncPage>::HandleFileChooser { | |
Box::new(AsyncCallSite::async_call(self, page::HandleFileChooserRequest { action, files }).map(|(_, self_)| ((), self_))) | |
} | |
} | |
/// Actions and events related to the inspected page belong to the page domain. | |
#[cfg(any(feature = "all", feature = "page"))] | |
#[allow(deprecated)] | |
pub mod page { | |
use serde::{Serialize, Deserialize}; | |
use crate::*; | |
/// Unique frame identifier. | |
pub type FrameId = String; | |
/// Information about the Frame on the page. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Frame { | |
/// Frame unique identifier. | |
pub id: FrameId, | |
/// Parent frame identifier. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub parent_id: Option<String>, | |
/// Identifier of the loader associated with this frame. | |
pub loader_id: network::LoaderId, | |
/// Frame's name as specified in the tag. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub name: Option<String>, | |
/// Frame document's URL without fragment. | |
pub url: String, | |
/// Frame document's URL fragment including the '#'. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub url_fragment: Option<String>, | |
/// Frame document's security origin. | |
pub security_origin: String, | |
/// Frame document's mimeType as determined by the browser. | |
pub mime_type: String, | |
/// If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub unreachable_url: Option<String>, | |
} | |
/// Information about the Resource on the page. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FrameResource { | |
/// Resource URL. | |
pub url: String, | |
/// Type of this resource. | |
#[serde(rename = "type")] | |
pub r#type: network::ResourceType, | |
/// Resource mimeType as determined by the browser. | |
pub mime_type: String, | |
/// last-modified timestamp as reported by server. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub last_modified: Option<network::TimeSinceEpoch>, | |
/// Resource content size. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub content_size: Option<Number>, | |
/// True if the resource failed to load. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub failed: Option<Boolean>, | |
/// True if the resource was canceled during loading. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub canceled: Option<Boolean>, | |
} | |
/// Information about the Frame hierarchy along with their cached resources. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FrameResourceTree { | |
/// Frame information for this tree item. | |
pub frame: Frame, | |
/// Child frames. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub child_frames: Option<Vec<FrameResourceTree>>, | |
/// Information about frame resources. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub resources: Vec<FrameResource>, | |
} | |
/// Information about the Frame hierarchy. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FrameTree { | |
/// Frame information for this tree item. | |
pub frame: Frame, | |
/// Child frames. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub child_frames: Option<Vec<FrameTree>>, | |
} | |
/// Unique script identifier. | |
pub type ScriptIdentifier = String; | |
/// Transition type. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum TransitionType { | |
Link, | |
Typed, | |
AddressBar, | |
AutoBookmark, | |
AutoSubframe, | |
ManualSubframe, | |
Generated, | |
AutoToplevel, | |
FormSubmit, | |
Reload, | |
Keyword, | |
KeywordGenerated, | |
Other, | |
} | |
/// Navigation history entry. | |
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NavigationEntry { | |
/// Unique id of the navigation history entry. | |
pub id: Integer, | |
/// URL of the navigation history entry. | |
pub url: String, | |
/// URL that the user typed in the url bar. | |
#[serde(rename = "userTypedURL")] | |
pub user_typed_url: String, | |
/// Title of the navigation history entry. | |
pub title: String, | |
/// Transition type. | |
pub transition_type: TransitionType, | |
} | |
/// Screencast frame metadata. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ScreencastFrameMetadata { | |
/// Top offset in DIP. | |
pub offset_top: Number, | |
/// Page scale factor. | |
pub page_scale_factor: Number, | |
/// Device screen width in DIP. | |
pub device_width: Number, | |
/// Device screen height in DIP. | |
pub device_height: Number, | |
/// Position of horizontal scroll in CSS pixels. | |
pub scroll_offset_x: Number, | |
/// Position of vertical scroll in CSS pixels. | |
pub scroll_offset_y: Number, | |
/// Frame swap timestamp. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub timestamp: Option<network::TimeSinceEpoch>, | |
} | |
/// Javascript dialog type. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum DialogType { | |
Alert, | |
Confirm, | |
Prompt, | |
Beforeunload, | |
} | |
/// Error while paring app manifest. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AppManifestError { | |
/// Error message. | |
pub message: String, | |
/// If criticial, this is a non-recoverable parse error. | |
pub critical: Integer, | |
/// Error line. | |
pub line: Integer, | |
/// Error column. | |
pub column: Integer, | |
} | |
/// Layout viewport position and dimensions. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct LayoutViewport { | |
/// Horizontal offset relative to the document (CSS pixels). | |
pub page_x: Integer, | |
/// Vertical offset relative to the document (CSS pixels). | |
pub page_y: Integer, | |
/// Width (CSS pixels), excludes scrollbar if present. | |
pub client_width: Integer, | |
/// Height (CSS pixels), excludes scrollbar if present. | |
pub client_height: Integer, | |
} | |
/// Visual viewport position, dimensions, and scale. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct VisualViewport { | |
/// Horizontal offset relative to the layout viewport (CSS pixels). | |
pub offset_x: Number, | |
/// Vertical offset relative to the layout viewport (CSS pixels). | |
pub offset_y: Number, | |
/// Horizontal offset relative to the document (CSS pixels). | |
pub page_x: Number, | |
/// Vertical offset relative to the document (CSS pixels). | |
pub page_y: Number, | |
/// Width (CSS pixels), excludes scrollbar if present. | |
pub client_width: Number, | |
/// Height (CSS pixels), excludes scrollbar if present. | |
pub client_height: Number, | |
/// Scale relative to the ideal viewport (size at width=device-width). | |
pub scale: Number, | |
/// Page zoom factor (CSS to device independent pixels ratio). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub zoom: Option<Number>, | |
} | |
/// Viewport for capturing screenshot. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct Viewport { | |
/// X offset in device independent pixels (dip). | |
pub x: Number, | |
/// Y offset in device independent pixels (dip). | |
pub y: Number, | |
/// Rectangle width in device independent pixels (dip). | |
pub width: Number, | |
/// Rectangle height in device independent pixels (dip). | |
pub height: Number, | |
/// Page scale factor. | |
pub scale: Number, | |
} | |
/// Generic font families collection. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FontFamilies { | |
/// The standard font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub standard: Option<String>, | |
/// The fixed font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub fixed: Option<String>, | |
/// The serif font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub serif: Option<String>, | |
/// The sansSerif font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub sans_serif: Option<String>, | |
/// The cursive font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub cursive: Option<String>, | |
/// The fantasy font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub fantasy: Option<String>, | |
/// The pictograph font-family. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub pictograph: Option<String>, | |
} | |
/// Default font sizes. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct FontSizes { | |
/// Default standard font size. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub standard: Option<Integer>, | |
/// Default fixed font size. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub fixed: Option<Integer>, | |
} | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum ClientNavigationReason { | |
FormSubmissionGet, | |
FormSubmissionPost, | |
HttpHeaderRefresh, | |
ScriptInitiated, | |
MetaTagRefresh, | |
PageBlockInterstitial, | |
Reload, | |
} | |
/// Method parameters of the `Page::addScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type AddScriptToEvaluateOnLoad = AddScriptToEvaluateOnLoadRequest; | |
/// Return object of the `Page::addScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type AddScriptToEvaluateOnLoadReturnObject = AddScriptToEvaluateOnLoadResponse; | |
/// Request object of the `Page::addScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddScriptToEvaluateOnLoadRequest { | |
pub script_source: String, | |
} | |
/// Response object of the `Page::addScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddScriptToEvaluateOnLoadResponse { | |
/// Identifier of the added script. | |
pub identifier: ScriptIdentifier, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for AddScriptToEvaluateOnLoad { | |
const NAME: &'static str = "Page.addScriptToEvaluateOnLoad"; | |
type ReturnObject = AddScriptToEvaluateOnLoadReturnObject; | |
} | |
/// Method parameters of the `Page::addScriptToEvaluateOnNewDocument` command. | |
pub type AddScriptToEvaluateOnNewDocument = AddScriptToEvaluateOnNewDocumentRequest; | |
/// Return object of the `Page::addScriptToEvaluateOnNewDocument` command. | |
pub type AddScriptToEvaluateOnNewDocumentReturnObject = AddScriptToEvaluateOnNewDocumentResponse; | |
/// Request object of the `Page::addScriptToEvaluateOnNewDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddScriptToEvaluateOnNewDocumentRequest { | |
pub source: String, | |
/// If specified, creates an isolated world with the given name and evaluates given script in it. | |
/// This world name will be used as the ExecutionContextDescription::name when the corresponding | |
/// event is emitted. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub world_name: Option<String>, | |
} | |
/// Response object of the `Page::addScriptToEvaluateOnNewDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct AddScriptToEvaluateOnNewDocumentResponse { | |
/// Identifier of the added script. | |
pub identifier: ScriptIdentifier, | |
} | |
impl Method for AddScriptToEvaluateOnNewDocument { | |
const NAME: &'static str = "Page.addScriptToEvaluateOnNewDocument"; | |
type ReturnObject = AddScriptToEvaluateOnNewDocumentReturnObject; | |
} | |
/// Method parameters of the `Page::bringToFront` command. | |
pub type BringToFront = BringToFrontRequest; | |
/// Return object of the `Page::bringToFront` command. | |
pub type BringToFrontReturnObject = BringToFrontResponse; | |
/// Request object of the `Page::bringToFront` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BringToFrontRequest { | |
} | |
/// Response object of the `Page::bringToFront` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct BringToFrontResponse { | |
} | |
impl Method for BringToFront { | |
const NAME: &'static str = "Page.bringToFront"; | |
type ReturnObject = BringToFrontReturnObject; | |
} | |
/// Method parameters of the `Page::captureScreenshot` command. | |
pub type CaptureScreenshot = CaptureScreenshotRequest; | |
/// Return object of the `Page::captureScreenshot` command. | |
pub type CaptureScreenshotReturnObject = CaptureScreenshotResponse; | |
/// Request object of the `Page::captureScreenshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureScreenshotRequest { | |
/// Image compression format (defaults to png). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub format: Option<CaptureScreenshotRequestFormat>, | |
/// Compression quality from range [0..100] (jpeg only). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub quality: Option<Integer>, | |
/// Capture the screenshot of a given region only. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub clip: Option<Viewport>, | |
/// Capture the screenshot from the surface, rather than the view. Defaults to true. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub from_surface: Option<Boolean>, | |
} | |
/// Allow values for the `CaptureScreenshotRequest::format` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CaptureScreenshotRequestFormat { | |
Jpeg, | |
Png, | |
} | |
/// Response object of the `Page::captureScreenshot` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureScreenshotResponse { | |
/// Base64-encoded image data. | |
pub data: Binary, | |
} | |
impl Method for CaptureScreenshot { | |
const NAME: &'static str = "Page.captureScreenshot"; | |
type ReturnObject = CaptureScreenshotReturnObject; | |
} | |
/// Method parameters of the `Page::captureSnapshot` command. | |
#[cfg(feature = "experimental")] | |
pub type CaptureSnapshot = CaptureSnapshotRequest; | |
/// Return object of the `Page::captureSnapshot` command. | |
#[cfg(feature = "experimental")] | |
pub type CaptureSnapshotReturnObject = CaptureSnapshotResponse; | |
/// Request object of the `Page::captureSnapshot` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureSnapshotRequest { | |
/// Format (defaults to mhtml). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub format: Option<CaptureSnapshotRequestFormat>, | |
} | |
/// Allow values for the `CaptureSnapshotRequest::format` field. | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum CaptureSnapshotRequestFormat { | |
Mhtml, | |
} | |
/// Response object of the `Page::captureSnapshot` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CaptureSnapshotResponse { | |
/// Serialized page data. | |
pub data: String, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for CaptureSnapshot { | |
const NAME: &'static str = "Page.captureSnapshot"; | |
type ReturnObject = CaptureSnapshotReturnObject; | |
} | |
/// Method parameters of the `Page::clearDeviceMetricsOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ClearDeviceMetricsOverride = ClearDeviceMetricsOverrideRequest; | |
/// Return object of the `Page::clearDeviceMetricsOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ClearDeviceMetricsOverrideReturnObject = ClearDeviceMetricsOverrideResponse; | |
/// Request object of the `Page::clearDeviceMetricsOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceMetricsOverrideRequest { | |
} | |
/// Response object of the `Page::clearDeviceMetricsOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceMetricsOverrideResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ClearDeviceMetricsOverride { | |
const NAME: &'static str = "Page.clearDeviceMetricsOverride"; | |
type ReturnObject = ClearDeviceMetricsOverrideReturnObject; | |
} | |
/// Method parameters of the `Page::clearDeviceOrientationOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ClearDeviceOrientationOverride = ClearDeviceOrientationOverrideRequest; | |
/// Return object of the `Page::clearDeviceOrientationOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type ClearDeviceOrientationOverrideReturnObject = ClearDeviceOrientationOverrideResponse; | |
/// Request object of the `Page::clearDeviceOrientationOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceOrientationOverrideRequest { | |
} | |
/// Response object of the `Page::clearDeviceOrientationOverride` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearDeviceOrientationOverrideResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for ClearDeviceOrientationOverride { | |
const NAME: &'static str = "Page.clearDeviceOrientationOverride"; | |
type ReturnObject = ClearDeviceOrientationOverrideReturnObject; | |
} | |
/// Method parameters of the `Page::clearGeolocationOverride` command. | |
#[deprecated] | |
pub type ClearGeolocationOverride = ClearGeolocationOverrideRequest; | |
/// Return object of the `Page::clearGeolocationOverride` command. | |
#[deprecated] | |
pub type ClearGeolocationOverrideReturnObject = ClearGeolocationOverrideResponse; | |
/// Request object of the `Page::clearGeolocationOverride` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearGeolocationOverrideRequest { | |
} | |
/// Response object of the `Page::clearGeolocationOverride` command. | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ClearGeolocationOverrideResponse { | |
} | |
impl Method for ClearGeolocationOverride { | |
const NAME: &'static str = "Page.clearGeolocationOverride"; | |
type ReturnObject = ClearGeolocationOverrideReturnObject; | |
} | |
/// Method parameters of the `Page::createIsolatedWorld` command. | |
pub type CreateIsolatedWorld = CreateIsolatedWorldRequest; | |
/// Return object of the `Page::createIsolatedWorld` command. | |
pub type CreateIsolatedWorldReturnObject = CreateIsolatedWorldResponse; | |
/// Request object of the `Page::createIsolatedWorld` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CreateIsolatedWorldRequest { | |
/// Id of the frame in which the isolated world should be created. | |
pub frame_id: FrameId, | |
/// An optional name which is reported in the Execution Context. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub world_name: Option<String>, | |
/// Whether or not universal access should be granted to the isolated world. This is a powerful | |
/// option, use with caution. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub grant_univeral_access: Option<Boolean>, | |
} | |
/// Response object of the `Page::createIsolatedWorld` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct CreateIsolatedWorldResponse { | |
/// Execution context of the isolated world. | |
pub execution_context_id: runtime::ExecutionContextId, | |
} | |
impl Method for CreateIsolatedWorld { | |
const NAME: &'static str = "Page.createIsolatedWorld"; | |
type ReturnObject = CreateIsolatedWorldReturnObject; | |
} | |
/// Method parameters of the `Page::deleteCookie` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type DeleteCookie = DeleteCookieRequest; | |
/// Return object of the `Page::deleteCookie` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type DeleteCookieReturnObject = DeleteCookieResponse; | |
/// Request object of the `Page::deleteCookie` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCookieRequest { | |
/// Name of the cookie to remove. | |
pub cookie_name: String, | |
/// URL to match cooke domain and path. | |
pub url: String, | |
} | |
/// Response object of the `Page::deleteCookie` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DeleteCookieResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for DeleteCookie { | |
const NAME: &'static str = "Page.deleteCookie"; | |
type ReturnObject = DeleteCookieReturnObject; | |
} | |
/// Method parameters of the `Page::disable` command. | |
pub type Disable = DisableRequest; | |
/// Return object of the `Page::disable` command. | |
pub type DisableReturnObject = DisableResponse; | |
/// Request object of the `Page::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableRequest { | |
} | |
/// Response object of the `Page::disable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct DisableResponse { | |
} | |
impl Method for Disable { | |
const NAME: &'static str = "Page.disable"; | |
type ReturnObject = DisableReturnObject; | |
} | |
/// Method parameters of the `Page::enable` command. | |
pub type Enable = EnableRequest; | |
/// Return object of the `Page::enable` command. | |
pub type EnableReturnObject = EnableResponse; | |
/// Request object of the `Page::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableRequest { | |
} | |
/// Response object of the `Page::enable` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct EnableResponse { | |
} | |
impl Method for Enable { | |
const NAME: &'static str = "Page.enable"; | |
type ReturnObject = EnableReturnObject; | |
} | |
/// Method parameters of the `Page::getAppManifest` command. | |
pub type GetAppManifest = GetAppManifestRequest; | |
/// Return object of the `Page::getAppManifest` command. | |
pub type GetAppManifestReturnObject = GetAppManifestResponse; | |
/// Request object of the `Page::getAppManifest` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAppManifestRequest { | |
} | |
/// Response object of the `Page::getAppManifest` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetAppManifestResponse { | |
/// Manifest location. | |
pub url: String, | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub errors: Vec<AppManifestError>, | |
/// Manifest content. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub data: Option<String>, | |
} | |
impl Method for GetAppManifest { | |
const NAME: &'static str = "Page.getAppManifest"; | |
type ReturnObject = GetAppManifestReturnObject; | |
} | |
/// Method parameters of the `Page::getInstallabilityErrors` command. | |
#[cfg(feature = "experimental")] | |
pub type GetInstallabilityErrors = GetInstallabilityErrorsRequest; | |
/// Return object of the `Page::getInstallabilityErrors` command. | |
#[cfg(feature = "experimental")] | |
pub type GetInstallabilityErrorsReturnObject = GetInstallabilityErrorsResponse; | |
/// Request object of the `Page::getInstallabilityErrors` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetInstallabilityErrorsRequest { | |
} | |
/// Response object of the `Page::getInstallabilityErrors` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetInstallabilityErrorsResponse { | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub errors: Vec<String>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetInstallabilityErrors { | |
const NAME: &'static str = "Page.getInstallabilityErrors"; | |
type ReturnObject = GetInstallabilityErrorsReturnObject; | |
} | |
/// Method parameters of the `Page::getCookies` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type GetCookies = GetCookiesRequest; | |
/// Return object of the `Page::getCookies` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type GetCookiesReturnObject = GetCookiesResponse; | |
/// Request object of the `Page::getCookies` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCookiesRequest { | |
} | |
/// Response object of the `Page::getCookies` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetCookiesResponse { | |
/// Array of cookie objects. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub cookies: Vec<network::Cookie>, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetCookies { | |
const NAME: &'static str = "Page.getCookies"; | |
type ReturnObject = GetCookiesReturnObject; | |
} | |
/// Method parameters of the `Page::getFrameTree` command. | |
pub type GetFrameTree = GetFrameTreeRequest; | |
/// Return object of the `Page::getFrameTree` command. | |
pub type GetFrameTreeReturnObject = GetFrameTreeResponse; | |
/// Request object of the `Page::getFrameTree` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFrameTreeRequest { | |
} | |
/// Response object of the `Page::getFrameTree` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetFrameTreeResponse { | |
/// Present frame tree structure. | |
pub frame_tree: FrameTree, | |
} | |
impl Method for GetFrameTree { | |
const NAME: &'static str = "Page.getFrameTree"; | |
type ReturnObject = GetFrameTreeReturnObject; | |
} | |
/// Method parameters of the `Page::getLayoutMetrics` command. | |
pub type GetLayoutMetrics = GetLayoutMetricsRequest; | |
/// Return object of the `Page::getLayoutMetrics` command. | |
pub type GetLayoutMetricsReturnObject = GetLayoutMetricsResponse; | |
/// Request object of the `Page::getLayoutMetrics` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetLayoutMetricsRequest { | |
} | |
/// Response object of the `Page::getLayoutMetrics` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetLayoutMetricsResponse { | |
/// Metrics relating to the layout viewport. | |
pub layout_viewport: LayoutViewport, | |
/// Metrics relating to the visual viewport. | |
pub visual_viewport: VisualViewport, | |
/// Size of scrollable area. | |
pub content_size: dom::Rect, | |
} | |
impl Method for GetLayoutMetrics { | |
const NAME: &'static str = "Page.getLayoutMetrics"; | |
type ReturnObject = GetLayoutMetricsReturnObject; | |
} | |
/// Method parameters of the `Page::getNavigationHistory` command. | |
pub type GetNavigationHistory = GetNavigationHistoryRequest; | |
/// Return object of the `Page::getNavigationHistory` command. | |
pub type GetNavigationHistoryReturnObject = GetNavigationHistoryResponse; | |
/// Request object of the `Page::getNavigationHistory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNavigationHistoryRequest { | |
} | |
/// Response object of the `Page::getNavigationHistory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetNavigationHistoryResponse { | |
/// Index of the current navigation history entry. | |
pub current_index: Integer, | |
/// Array of navigation history entries. | |
#[serde(skip_serializing_if = "Vec::is_empty")] | |
pub entries: Vec<NavigationEntry>, | |
} | |
impl Method for GetNavigationHistory { | |
const NAME: &'static str = "Page.getNavigationHistory"; | |
type ReturnObject = GetNavigationHistoryReturnObject; | |
} | |
/// Method parameters of the `Page::resetNavigationHistory` command. | |
pub type ResetNavigationHistory = ResetNavigationHistoryRequest; | |
/// Return object of the `Page::resetNavigationHistory` command. | |
pub type ResetNavigationHistoryReturnObject = ResetNavigationHistoryResponse; | |
/// Request object of the `Page::resetNavigationHistory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetNavigationHistoryRequest { | |
} | |
/// Response object of the `Page::resetNavigationHistory` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ResetNavigationHistoryResponse { | |
} | |
impl Method for ResetNavigationHistory { | |
const NAME: &'static str = "Page.resetNavigationHistory"; | |
type ReturnObject = ResetNavigationHistoryReturnObject; | |
} | |
/// Method parameters of the `Page::getResourceContent` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResourceContent = GetResourceContentRequest; | |
/// Return object of the `Page::getResourceContent` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResourceContentReturnObject = GetResourceContentResponse; | |
/// Request object of the `Page::getResourceContent` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResourceContentRequest { | |
/// Frame id to get resource for. | |
pub frame_id: FrameId, | |
/// URL of the resource to get content for. | |
pub url: String, | |
} | |
/// Response object of the `Page::getResourceContent` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResourceContentResponse { | |
/// Resource content. | |
pub content: String, | |
/// True, if content was served as base64. | |
pub base64_encoded: Boolean, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetResourceContent { | |
const NAME: &'static str = "Page.getResourceContent"; | |
type ReturnObject = GetResourceContentReturnObject; | |
} | |
/// Method parameters of the `Page::getResourceTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResourceTree = GetResourceTreeRequest; | |
/// Return object of the `Page::getResourceTree` command. | |
#[cfg(feature = "experimental")] | |
pub type GetResourceTreeReturnObject = GetResourceTreeResponse; | |
/// Request object of the `Page::getResourceTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResourceTreeRequest { | |
} | |
/// Response object of the `Page::getResourceTree` command. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct GetResourceTreeResponse { | |
/// Present frame / resource tree structure. | |
pub frame_tree: FrameResourceTree, | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for GetResourceTree { | |
const NAME: &'static str = "Page.getResourceTree"; | |
type ReturnObject = GetResourceTreeReturnObject; | |
} | |
/// Method parameters of the `Page::handleJavaScriptDialog` command. | |
pub type HandleJavaScriptDialog = HandleJavaScriptDialogRequest; | |
/// Return object of the `Page::handleJavaScriptDialog` command. | |
pub type HandleJavaScriptDialogReturnObject = HandleJavaScriptDialogResponse; | |
/// Request object of the `Page::handleJavaScriptDialog` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HandleJavaScriptDialogRequest { | |
/// Whether to accept or dismiss the dialog. | |
pub accept: Boolean, | |
/// The text to enter into the dialog prompt before accepting. Used only if this is a prompt | |
/// dialog. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub prompt_text: Option<String>, | |
} | |
/// Response object of the `Page::handleJavaScriptDialog` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct HandleJavaScriptDialogResponse { | |
} | |
impl Method for HandleJavaScriptDialog { | |
const NAME: &'static str = "Page.handleJavaScriptDialog"; | |
type ReturnObject = HandleJavaScriptDialogReturnObject; | |
} | |
/// Method parameters of the `Page::navigate` command. | |
pub type Navigate = NavigateRequest; | |
/// Return object of the `Page::navigate` command. | |
pub type NavigateReturnObject = NavigateResponse; | |
/// Request object of the `Page::navigate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NavigateRequest { | |
/// URL to navigate the page to. | |
pub url: String, | |
/// Referrer URL. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub referrer: Option<String>, | |
/// Intended transition type. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub transition_type: Option<TransitionType>, | |
/// Frame id to navigate, if not specified navigates the top frame. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub frame_id: Option<FrameId>, | |
} | |
/// Response object of the `Page::navigate` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NavigateResponse { | |
/// Frame id that has navigated (or failed to navigate) | |
pub frame_id: FrameId, | |
/// Loader identifier. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub loader_id: Option<network::LoaderId>, | |
/// User friendly error message, present if and only if navigation has failed. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub error_text: Option<String>, | |
} | |
impl Method for Navigate { | |
const NAME: &'static str = "Page.navigate"; | |
type ReturnObject = NavigateReturnObject; | |
} | |
/// Method parameters of the `Page::navigateToHistoryEntry` command. | |
pub type NavigateToHistoryEntry = NavigateToHistoryEntryRequest; | |
/// Return object of the `Page::navigateToHistoryEntry` command. | |
pub type NavigateToHistoryEntryReturnObject = NavigateToHistoryEntryResponse; | |
/// Request object of the `Page::navigateToHistoryEntry` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NavigateToHistoryEntryRequest { | |
/// Unique id of the entry to navigate to. | |
pub entry_id: Integer, | |
} | |
/// Response object of the `Page::navigateToHistoryEntry` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct NavigateToHistoryEntryResponse { | |
} | |
impl Method for NavigateToHistoryEntry { | |
const NAME: &'static str = "Page.navigateToHistoryEntry"; | |
type ReturnObject = NavigateToHistoryEntryReturnObject; | |
} | |
/// Method parameters of the `Page::printToPDF` command. | |
pub type PrintToPDF = PrintToPDFRequest; | |
/// Return object of the `Page::printToPDF` command. | |
pub type PrintToPDFReturnObject = PrintToPDFResponse; | |
/// Request object of the `Page::printToPDF` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PrintToPDFRequest { | |
/// Paper orientation. Defaults to false. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub landscape: Option<Boolean>, | |
/// Display header and footer. Defaults to false. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub display_header_footer: Option<Boolean>, | |
/// Print background graphics. Defaults to false. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub print_background: Option<Boolean>, | |
/// Scale of the webpage rendering. Defaults to 1. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub scale: Option<Number>, | |
/// Paper width in inches. Defaults to 8.5 inches. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub paper_width: Option<Number>, | |
/// Paper height in inches. Defaults to 11 inches. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub paper_height: Option<Number>, | |
/// Top margin in inches. Defaults to 1cm (~0.4 inches). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub margin_top: Option<Number>, | |
/// Bottom margin in inches. Defaults to 1cm (~0.4 inches). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub margin_bottom: Option<Number>, | |
/// Left margin in inches. Defaults to 1cm (~0.4 inches). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub margin_left: Option<Number>, | |
/// Right margin in inches. Defaults to 1cm (~0.4 inches). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub margin_right: Option<Number>, | |
/// Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means | |
/// print all pages. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub page_ranges: Option<String>, | |
/// Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'. | |
/// Defaults to false. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub ignore_invalid_page_ranges: Option<Boolean>, | |
/// HTML template for the print header. Should be valid HTML markup with following | |
/// classes used to inject printing values into them: | |
/// - `date`: formatted print date | |
/// - `title`: document title | |
/// - `url`: document location | |
/// - `pageNumber`: current page number | |
/// - `totalPages`: total pages in the document | |
/// | |
/// For example, `<span class=title></span>` would generate span containing the title. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub header_template: Option<String>, | |
/// HTML template for the print footer. Should use the same format as the `headerTemplate`. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub footer_template: Option<String>, | |
/// Whether or not to prefer page size as defined by css. Defaults to false, | |
/// in which case the content will be scaled to fit the paper size. | |
#[serde(rename = "preferCSSPageSize")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub prefer_css_page_size: Option<Boolean>, | |
/// return as stream | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub transfer_mode: Option<PrintToPDFRequestTransferMode>, | |
} | |
/// Allow values for the `PrintToPDFRequest::transferMode` field. | |
#[cfg(feature = "experimental")] | |
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "kebab-case")] | |
pub enum PrintToPDFRequestTransferMode { | |
ReturnAsBase64, | |
ReturnAsStream, | |
} | |
/// Response object of the `Page::printToPDF` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct PrintToPDFResponse { | |
/// Base64-encoded pdf data. Empty if |returnAsStream| is specified. | |
pub data: Binary, | |
/// A handle of the stream that holds resulting PDF data. | |
#[cfg(feature = "experimental")] | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub stream: Option<io::StreamHandle>, | |
} | |
impl Method for PrintToPDF { | |
const NAME: &'static str = "Page.printToPDF"; | |
type ReturnObject = PrintToPDFReturnObject; | |
} | |
/// Method parameters of the `Page::reload` command. | |
pub type Reload = ReloadRequest; | |
/// Return object of the `Page::reload` command. | |
pub type ReloadReturnObject = ReloadResponse; | |
/// Request object of the `Page::reload` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReloadRequest { | |
/// If true, browser cache is ignored (as if the user pressed Shift+refresh). | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub ignore_cache: Option<Boolean>, | |
/// If set, the script will be injected into all frames of the inspected page after reload. | |
/// Argument will be ignored if reloading dataURL origin. | |
#[serde(skip_serializing_if = "Option::is_none")] | |
pub script_to_evaluate_on_load: Option<String>, | |
} | |
/// Response object of the `Page::reload` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct ReloadResponse { | |
} | |
impl Method for Reload { | |
const NAME: &'static str = "Page.reload"; | |
type ReturnObject = ReloadReturnObject; | |
} | |
/// Method parameters of the `Page::removeScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type RemoveScriptToEvaluateOnLoad = RemoveScriptToEvaluateOnLoadRequest; | |
/// Return object of the `Page::removeScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
pub type RemoveScriptToEvaluateOnLoadReturnObject = RemoveScriptToEvaluateOnLoadResponse; | |
/// Request object of the `Page::removeScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveScriptToEvaluateOnLoadRequest { | |
pub identifier: ScriptIdentifier, | |
} | |
/// Response object of the `Page::removeScriptToEvaluateOnLoad` command. | |
#[cfg(feature = "experimental")] | |
#[deprecated] | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveScriptToEvaluateOnLoadResponse { | |
} | |
#[cfg(feature = "experimental")] | |
impl Method for RemoveScriptToEvaluateOnLoad { | |
const NAME: &'static str = "Page.removeScriptToEvaluateOnLoad"; | |
type ReturnObject = RemoveScriptToEvaluateOnLoadReturnObject; | |
} | |
/// Method parameters of the `Page::removeScriptToEvaluateOnNewDocument` command. | |
pub type RemoveScriptToEvaluateOnNewDocument = RemoveScriptToEvaluateOnNewDocumentRequest; | |
/// Return object of the `Page::removeScriptToEvaluateOnNewDocument` command. | |
pub type RemoveScriptToEvaluateOnNewDocumentReturnObject = RemoveScriptToEvaluateOnNewDocumentResponse; | |
/// Request object of the `Page::removeScriptToEvaluateOnNewDocument` command. | |
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
#[serde(rename_all = "camelCase")] | |
pub struct RemoveScriptToEvaluateOnNewDocumentRequest { | |
pub identifier: ScriptIdentifier, | |
} | |
/// Response object of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment