Skip to content

Commit a74c9e8

Browse files
Merge pull request #389 from lightpanda-io/cdp-empty-params
chromedp: msg missing params or result
2 parents 3fb1677 + 8aac26a commit a74c9e8

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/cdp/cdp.zig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ pub fn sendEvent(
206206
params: T,
207207
sessionID: ?[]const u8,
208208
) !void {
209+
// some clients like chromedp expects empty parameters structs.
210+
if (T == void) @compileError("sendEvent: use struct{} instead of void for empty parameters");
211+
209212
log_cdp.debug("Event > method {s}, sessionID {?s}", .{ name, sessionID });
210213
const Resp = struct {
211214
method: []const u8,

src/cdp/page.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn navigate(
329329

330330
// Send Runtime.executionContextsCleared event
331331
// TODO: noop event, we have no env context at this point, is it necesarry?
332-
try sendEvent(alloc, ctx, "Runtime.executionContextsCleared", void, {}, input.sessionId);
332+
try sendEvent(alloc, ctx, "Runtime.executionContextsCleared", struct {}, .{}, input.sessionId);
333333

334334
// Launch navigate, the page must have been created by a
335335
// target.createTarget.

0 commit comments

Comments
 (0)