Skip to main content

Module actor

Module actor 

Source
Expand description

Background interception actor.

The crate-private run_actor is the rule-driven loop spawned by InterceptBuilder::start. It owns a single tab’s Fetch.* interception lifecycle:

  1. Subscribes to Fetch.requestPaused on the supplied SessionHandle before firing Fetch.enable. Mirrors the subscriber pattern used by the zendriver core’s frame-lifecycle and network-idle trackers — events Chrome fires between the enable round-trip and our subscription would otherwise be dropped, and the MockConnection test harness in zendriver-transport (gated feature = "testing") never replies to fire-and-forget enables anyway.
  2. Sends Fetch.enable { patterns, handleAuthRequests } with the explicit pattern list supplied by the builder; handleAuthRequests flips to true when the builder also called InterceptBuilder::handle_auth so Chrome surfaces Fetch.authRequired events the actor answers with Fetch.continueWithAuth.
  3. Per Fetch.requestPaused event: walks rules in registration order, first match wins, dispatches the matching action’s CDP call. No match → plain Fetch.continueRequest (let through).
  4. On cancellation: fires Fetch.disable and exits. The handle returned by the builder owns a CancellationToken that fires on Drop, so interception always tears down deterministically when the handle leaves scope.

InterceptHandle is the user-facing RAII guard. Its stop method is the explicit-shutdown path — it cancels the token and awaits a oneshot the actor signals on exit, so the caller observes Fetch.disable has reached the wire before stop() returns.

Structs§

InterceptHandle
RAII guard returned by InterceptBuilder::start (Task 7).