MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / handle_cdp_method

Function handle_cdp_method

packages/server/src/devtools.rs:1316–1502  ·  view source on GitHub ↗
(
    state: &mut CdpState,
    target: &ChromeDevToolsTargetRuntime,
    query: DevToolsQuery,
    method: &str,
    params: Value,
)

Source from the content-addressed store, hash-verified

1314}
1315
1316async fn handle_cdp_method(
1317 state: &mut CdpState,
1318 target: &ChromeDevToolsTargetRuntime,
1319 query: DevToolsQuery,
1320 method: &str,
1321 params: Value,
1322) -> Result<CdpResponse, String> {
1323 let mut events = Vec::new();
1324 let result = match method {
1325 "Browser.getVersion" => json!({
1326 "protocolVersion": "1.3",
1327 "product": "SimDeck",
1328 "revision": "simdeck",
1329 "userAgent": "SimDeck Chrome DevTools Adapter",
1330 "jsVersion": "0",
1331 }),
1332 "Schema.getDomains" => json!({
1333 "domains": [
1334 { "name": "Runtime", "version": "1.3" },
1335 { "name": "DOM", "version": "1.3" },
1336 { "name": "Page", "version": "1.3" },
1337 { "name": "CSS", "version": "1.3" },
1338 { "name": "Log", "version": "1.3" },
1339 { "name": "Target", "version": "1.3" }
1340 ],
1341 }),
1342 "Target.getTargets" => json!({
1343 "targetInfos": [target_info(target)],
1344 }),
1345 "Target.setDiscoverTargets" | "Target.setAutoAttach" => json!({}),
1346 "Runtime.enable" => {
1347 if !state.execution_context_sent {
1348 events.push(json!({
1349 "method": "Runtime.executionContextCreated",
1350 "params": {
1351 "context": execution_context(target),
1352 },
1353 }));
1354 state.execution_context_sent = true;
1355 }
1356 json!({})
1357 }
1358 "Runtime.getIsolateId" => json!({ "id": "simdeck" }),
1359 "Runtime.runIfWaitingForDebugger"
1360 | "Runtime.releaseObject"
1361 | "Runtime.releaseObjectGroup"
1362 | "Runtime.discardConsoleEntries"
1363 | "Debugger.enable"
1364 | "Debugger.disable"
1365 | "Debugger.setAsyncCallStackDepth"
1366 | "Debugger.setPauseOnExceptions"
1367 | "Debugger.setBlackboxPatterns"
1368 | "Debugger.setBreakpointsActive"
1369 | "Page.enable"
1370 | "Page.disable"
1371 | "Page.setLifecycleEventsEnabled"
1372 | "Log.enable"
1373 | "Log.clear"

Callers 1

handle_socket_innerFunction · 0.85

Calls 6

runtime_evaluateFunction · 0.85
runtime_get_propertiesFunction · 0.85
refreshMethod · 0.80
maxMethod · 0.80
cloneMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected