Allow method with sessionId and use it when appropriate (*.enable)

Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
Francis Bouvier
2024-04-16 17:19:50 +02:00
parent 36dbc28bde
commit 9e8b765f7a
5 changed files with 66 additions and 20 deletions

View File

@@ -2,9 +2,10 @@ const std = @import("std");
const server = @import("../server.zig");
const Ctx = server.Cmd;
const result = @import("cdp.zig").result;
const getParams = @import("cdp.zig").getParams;
const stringify = @import("cdp.zig").stringify;
const cdp = @import("cdp.zig");
const result = cdp.result;
const getParams = cdp.getParams;
const stringify = cdp.stringify;
const PageMethods = enum {
enable,
@@ -33,10 +34,13 @@ pub fn page(
fn enable(
alloc: std.mem.Allocator,
id: u64,
_: *std.json.Scanner,
scanner: *std.json.Scanner,
_: *Ctx,
) ![]const u8 {
return result(alloc, id, null, null);
return stringify(alloc, cdp.SessionIDResp{
.id = id,
.sessionId = try cdp.getSessionID(alloc, scanner),
});
}
fn getFrameTree(