Merge pull request #1808 from lightpanda-io/cdp_startup_frames

Tweak CDP startup messages.
This commit is contained in:
Karl Seguin
2026-03-13 19:24:14 +08:00
committed by GitHub
2 changed files with 7 additions and 6 deletions

View File

@@ -196,7 +196,7 @@ pub fn CDPT(comptime TypeProvider: type) type {
return command.sendResult(.{ return command.sendResult(.{
.frameTree = .{ .frameTree = .{
.frame = .{ .frame = .{
.id = "TID-STARTUP-B", .id = "TID-STARTUP",
.loaderId = "LOADERID24DD2FD56CF1EF33C965C79C", .loaderId = "LOADERID24DD2FD56CF1EF33C965C79C",
.securityOrigin = URL_BASE, .securityOrigin = URL_BASE,
.url = "about:blank", .url = "about:blank",

View File

@@ -340,7 +340,7 @@ fn getTargetInfo(cmd: anytype) !void {
return cmd.sendResult(.{ return cmd.sendResult(.{
.targetInfo = TargetInfo{ .targetInfo = TargetInfo{
.targetId = "TID-STARTUP-B", .targetId = "TID-STARTUP",
.type = "browser", .type = "browser",
.title = "", .title = "",
.url = "about:blank", .url = "about:blank",
@@ -424,14 +424,13 @@ fn setAutoAttach(cmd: anytype) !void {
// set a flag to send Target.attachedToTarget events // set a flag to send Target.attachedToTarget events
cmd.cdp.target_auto_attach = params.autoAttach; cmd.cdp.target_auto_attach = params.autoAttach;
try cmd.sendResult(null, .{});
if (cmd.cdp.target_auto_attach == false) { if (cmd.cdp.target_auto_attach == false) {
// detach from all currently attached targets. // detach from all currently attached targets.
if (cmd.browser_context) |bc| { if (cmd.browser_context) |bc| {
bc.session_id = null; bc.session_id = null;
// TODO should we send a Target.detachedFromTarget event? // TODO should we send a Target.detachedFromTarget event?
} }
try cmd.sendResult(null, .{});
return; return;
} }
@@ -444,7 +443,7 @@ fn setAutoAttach(cmd: anytype) !void {
try doAttachtoTarget(cmd, &bc.target_id.?); try doAttachtoTarget(cmd, &bc.target_id.?);
} }
} }
// should we send something here? try cmd.sendResult(null, .{});
return; return;
} }
@@ -460,12 +459,14 @@ fn setAutoAttach(cmd: anytype) !void {
.sessionId = "STARTUP", .sessionId = "STARTUP",
.targetInfo = TargetInfo{ .targetInfo = TargetInfo{
.type = "page", .type = "page",
.targetId = "TID-STARTUP-P", .targetId = "TID-STARTUP",
.title = "", .title = "",
.url = "about:blank", .url = "about:blank",
.browserContextId = "BID-STARTUP", .browserContextId = "BID-STARTUP",
}, },
}, .{}); }, .{});
try cmd.sendResult(null, .{});
} }
fn doAttachtoTarget(cmd: anytype, target_id: []const u8) !void { fn doAttachtoTarget(cmd: anytype, target_id: []const u8) !void {