registerReconnectRestore

abstract suspend fun registerReconnectRestore(key: Any, restore: suspend () -> Unit)

Registers a restore action to be re-run automatically after the connection transparently reconnects.

A reconnect opens a fresh CDP session that has lost all session-scoped state (enabled domains, overrides such as the user agent, scripts injected with addScriptToEvaluateOnNewDocument, …). Features that establish such state register a restorer here — keyed by key so it can be replaced or removed — and remove it with unregisterReconnectRestore when they tear that state down. Each restorer runs at most once per reconnect, before the command that triggered the restore proceeds; a concurrent command may still race ahead of an in-progress restore. A restorer that throws is logged and skipped rather than failing the command.

A restorer must only re-issue CDP commands; it must not itself call registerReconnectRestore/unregisterReconnectRestore.