mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 22:03:52 +00:00
feat: [US-040] - Remove with_cdp method from BrowserRuntime
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c8d0679fa4
commit
cd9d71f736
1 changed files with 0 additions and 17 deletions
|
|
@ -560,23 +560,6 @@ impl BrowserRuntime {
|
||||||
let _ = self.stop().await;
|
let _ = self.stop().await;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a closure with the CDP client while holding the state lock.
|
|
||||||
pub async fn with_cdp<F, Fut, T>(&self, f: F) -> Result<T, BrowserProblem>
|
|
||||||
where
|
|
||||||
F: FnOnce(&CdpClient) -> Fut,
|
|
||||||
Fut: std::future::Future<Output = Result<T, BrowserProblem>>,
|
|
||||||
{
|
|
||||||
let state = self.inner.lock().await;
|
|
||||||
if state.state != BrowserState::Active {
|
|
||||||
return Err(BrowserProblem::not_active());
|
|
||||||
}
|
|
||||||
let cdp = state
|
|
||||||
.cdp_client
|
|
||||||
.as_ref()
|
|
||||||
.ok_or_else(|| BrowserProblem::cdp_error("CDP client is not connected"))?;
|
|
||||||
f(cdp).await
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get an Arc-wrapped CDP client handle.
|
/// Get an Arc-wrapped CDP client handle.
|
||||||
///
|
///
|
||||||
/// Returns a cloned `Arc<CdpClient>` after verifying the browser is active.
|
/// Returns a cloned `Arc<CdpClient>` after verifying the browser is active.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue