Skip to main content

rightkit_browser/
lib.rs

1//! Shared Chrome DevTools Protocol browser runtime for Right Suite products.
2//!
3//! * [`BrowserSession`] owns one Chrome process and any number of pages. Launch uses Chrome
4//!   for Testing ([`chrome_for_testing_path`]); the system browser only with
5//!   [`LaunchOptions::system_chrome`] or [`LaunchOptions::system_chrome_only`].
6//!   Shutdown and drop close gracefully (CDP
7//!   `Browser.close` / SIGTERM to the process group, bounded waits, SIGKILL last).
8//! * [`ProfileSpec`] selects a temporary, named persistent, or caller-owned directory profile.
9//! * Pointer and keyboard actions use real `Input.dispatch*Event` commands, so
10//!   `event.isTrusted`, `:hover`, focus, and default actions behave as for a user.
11//! * [`NetworkPolicy`] blocks loopback/link-local/private/reserved/`file:` targets
12//!   (redirects, subresources, and every proxied connection included) before they
13//!   reach the network; denials are typed ([`BrowserError::Blocked`]).
14//! * [`AdmissionHook`] then gates every effect before it happens.
15//! * [`BrowserEvent`] reports start/stop/crash/denied with session id, reason, and time.
16//! * [`BrowserPage::set_request_interceptor`] lets the caller continue, rewrite, fulfil or fail
17//!   every request after the network policy; [`BrowserPage::accessibility_tree`],
18//!   [`BrowserPage::exceptions`], [`BrowserPage::set_page_scale`] and
19//!   [`BrowserPage::set_download_behavior`] expose the matching CDP domains.
20//! * Real-session mode (consent-gated): [`default_browser`], [`UserConsentReceipt`],
21//!   [`ProfileSpec::ImportedFrom`] and [`BrowserSession::attach_user_browser`] reuse the user's
22//!   own sign-ins in a private copy, confined to the consented domains. See [`ImportSpec`].
23//! * [`BrowserPage::observe`] returns refs that are checked for staleness before use.
24//! * [`design_mode`] holds the element-picker primitives: an isolated-world binding bridge,
25//!   a one-shot native-gesture submit gate, device-pixel capture geometry and the picker script builder.
26mod cdp_ext;
27mod config;
28pub mod design_mode;
29mod error;
30mod fixture;
31mod fixture_protocol;
32mod fixture_server;
33#[cfg(feature = "install")]
34pub mod install;
35mod keys;
36mod page;
37#[cfg(windows)]
38mod pipe_transport;
39mod policy;
40mod proc;
41mod proxy;
42mod real_session;
43mod sandbox_access;
44mod session;
45
46pub use cdp_ext::{
47    AxNode, AxSummary, ContinueOverrides, DownloadBehavior, ExceptionFrame, InterceptDecision,
48    InterceptFailure, InterceptStage, InterceptedRequest, PageException, RequestInterceptor,
49    MAX_EXCEPTIONS,
50};
51pub use config::{
52    chrome_for_testing_candidates, chrome_for_testing_path, find_chrome, LaunchOptions,
53    ProfileSpec, CHROME_FOR_TESTING_ENV, CHROME_FOR_TESTING_INSTALL_HINT,
54    CHROME_FOR_TESTING_ROOT_ENV,
55};
56pub use error::{BrowserError, Result};
57pub use fixture::{
58    FixtureAttestation, FixtureCancellation, FixtureCleanupEvidence, FixtureConfinementBackend,
59    FixtureOutcome, FixtureOutcomeStatus, FixtureRunFailure, FixtureSession,
60};
61pub use fixture_protocol::{
62    actions_digest, FixtureAction, FixtureBundle, FixtureError, FixtureFile, FixtureIntent,
63    FixtureKey, FIXTURE_SCHEMA,
64};
65pub use fixture_server::FixtureServer;
66pub use page::{
67    BrowserPage, ConsoleLine, Observation, ObservedNode, Rect, ScreenshotOptions, Target,
68    OBSERVE_AX_DEPTH,
69};
70pub use policy::{
71    classify_ip, ActionKind, AddressClass, AdmissionHook, AdmissionRequest, AllowCallback,
72    BlockReason, BlockedRequest, BrowserEvent, BrowserRequest, Decision, EventSink, LifecycleKind,
73    NetworkPolicy, NetworkRequest, PolicyDecision, PolicyDenial, Resolver,
74};
75pub use proxy::PinnedConnection;
76pub use real_session::{
77    browser_executable, default_browser, list_profiles, purge_imported_profile, user_data_dir,
78    BrowserKind, BrowserSource, ConsentRevocation, ImportReport, ImportSpec, SourceProfile,
79    UserConsentReceipt, CONSENT_SCHEMA,
80};
81pub use session::{BrowserSession, PageSetup};