fix(cdp): stub setDownloadBehavior, detachFromTarget, activateTarget

These Chrome CDP methods logged "Unknown method" warnings. obscura runs
one page per session and does not download to disk, so there is nothing
to do, but clients that call them should get a success ack instead of a
warning. Added as no-op stubs.

Refs #340.
This commit is contained in:
SGavrl committed 2026-07-01 06:55:37 +00:00
1 parent 630f9894f6
commit 7440b534f3
2 files changed
+6

No files matched your search

+2
View File
@@ -220,9 +220,11 @@ fn is_v8_free_method(method: &str) -> bool {
| "Target.setAutoAttach"
| "Target.getBrowserContexts" | "Target.createBrowserContext"
| "Target.disposeBrowserContext" | "Target.getTargetInfo"
| "Target.detachFromTarget" | "Target.activateTarget"
| "Browser.getVersion" | "Browser.close" | "Browser.getWindowForTarget"
| "Browser.setDownloadBehavior" | "Browser.getWindowBounds" | "Browser.setWindowBounds"
| "Page.enable" | "Page.disable" | "Page.getFrameTree"
| "Page.setDownloadBehavior"
| "Page.setLifecycleEventsEnabled"
| "Page.addScriptToEvaluateOnNewDocument" | "Page.removeScriptToEvaluateOnNewDocument"
| "Page.setInterceptFileChooserDialog" | "Page.getNavigationHistory"
+4
View File
@@ -195,6 +195,10 @@ pub async fn handle(method: &str, params: &Value, ctx: &mut CdpContext) -> Resul
Ok(json!({ "success": true }))
}
"setAutoAttach" => Ok(json!({})),
// No multi-target lifecycle to manage: obscura runs one page per session.
// Ack these so Chrome-shaped clients that call them do not warn (issue #340).
"detachFromTarget" => Ok(json!({})),
"activateTarget" => Ok(json!({})),
"getBrowserContexts" => {
Ok(json!({ "browserContextIds": [ctx.default_context.id] }))
}