Handle Runtime.evaluate (no-op)

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-05-27 16:02:14 +02:00
parent bafdca3ffa
commit c57e50c5b9
2 changed files with 26 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ const stringify = cdp.stringify;
const RuntimeMethods = enum {
enable,
runIfWaitingForDebugger,
evaluate,
};
pub fn runtime(
@@ -24,6 +25,7 @@ pub fn runtime(
return switch (method) {
.enable => enable(alloc, id, scanner, ctx),
.runIfWaitingForDebugger => runIfWaitingForDebugger(alloc, id, scanner, ctx),
.evaluate => evaluate(alloc, id, scanner, ctx),
};
}
@@ -103,3 +105,25 @@ fn runIfWaitingForDebugger(
const sessionID = try cdp.getSessionID(scanner);
return result(alloc, id, null, null, sessionID);
}
fn evaluate(
alloc: std.mem.Allocator,
_: u64,
scanner: *std.json.Scanner,
_: *Ctx,
) ![]const u8 {
// input
const Params = struct {
expression: []const u8,
contextId: ?u8,
};
const input = try cdp.getContent(alloc, Params, scanner);
const sessionID = input.sessionID;
std.debug.assert(sessionID != null);
std.log.debug("expr: len {d}", .{input.params.expression.len});
return error.CDPNormal;
}