Expand description
CDP Domain Manager
Centralized helper that enables and disables Chrome DevTools Protocol domains.
§Design Goals
- Required Domains Managed Automatically: Core domains such as Page, Runtime, DOM, and Network can be enabled up-front and stay active for the lifetime of the page (RAII-style).
- Optional Domains On Demand: Optional domains like Fetch, Performance, and CSS expose explicit enable/disable helpers so they are activated only when needed.
- Guard Against Duplicate Operations: Internal state tracks each domain so repeated enable/disable calls become no-ops.
- Resource Efficiency: Domains remain disabled until requested, keeping browser overhead low.
§Examples
// Required domains (Page, Runtime, DOM, Network) are enabled when the page is created.
// Enable optional domains as needed.
page.domain_manager.enable_fetch_domain().await?;
page.domain_manager.enable_performance_domain().await?;
// Disable optional domains to free resources once finished.
page.domain_manager.disable_fetch_domain().await?;
page.domain_manager.disable_performance_domain().await?;
// When the page is dropped, all domains are cleaned up automatically.Structs§
- Domain
Config - Configuration values applied while enabling individual domains.
- Domain
Manager - Coordinates enabling/disabling Chrome domains in a Page lifecycle.
Enums§
- Domain
State - Tracks the current enablement status for a domain.
- Domain
Type - Enumerates known Chrome domains this crate manages.