MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / stash_tab_emulation

Function stash_tab_emulation

src/cdp.rs:155–163  ·  view source on GitHub ↗

Stash an outgoing tab's emulation state under its target id so it can be restored when that tab becomes active again. Empty state is dropped so the map doesn't accumulate blank entries for every tab ever visited. Pure (no I/O) — this is the per-tab isolation invariant and is unit-tested below.

(
    saved: &mut std::collections::HashMap<String, TabEmulation>,
    target: String,
    state: TabEmulation,
)

Source from the content-addressed store, hash-verified

153/// map doesn't accumulate blank entries for every tab ever visited. Pure (no
154/// I/O) — this is the per-tab isolation invariant and is unit-tested below.
155fn stash_tab_emulation(
156 saved: &mut std::collections::HashMap<String, TabEmulation>,
157 target: String,
158 state: TabEmulation,
159) {
160 if !state.is_empty() {
161 saved.insert(target, state);
162 }
163}
164
165impl CdpClient {
166 /// Connect to Chrome via WebSocket and return a CDP client.

Calls 1

is_emptyMethod · 0.80