Skip to main content

Module backend

Module backend 

Source
Expand description

Engine-agnostic tab backend used by the named-tab registry and the scratch-recovery wrapper.

Tab operations on Chromium-family browsers go through CDP (Target.* + per-target session attach), and on Firefox via WebDriver BiDi (browsingContext.* + script.evaluate). The named-tab CLI and the scratch-tab recovery wrapper are engine-independent and just need these four primitives:

  • create a fresh tab at a URL (about:blank if unspecified).
  • close a tab by its engine-specific id.
  • navigate an existing tab to a URL.
  • list every live top-level tab id.

Plus one more for the eval/fetch path:

  • evaluate a JS expression in a tab, returning the result value.

target_id is an opaque String on both engines — CDP’s targetId and BiDi’s context are both opaque ids the registry stores verbatim.

Structs§

LiveTarget
Lightweight view of a live tab returned by TabBackend::live_targets. Used by tab list --all to merge the named-tab registry with the browser’s current target/context set.

Enums§

TabBackend
Engine-agnostic tab operations. Two variants because CDP and BiDi have different protocols and clients; the methods abstract over the difference.

Functions§

open_backend
Open the right TabBackend for a resolved browser endpoint, taking care of BiDi’s session.new handshake. The returned backend is Clone and owns its underlying client via Arc.