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(.{
.frameTree = .{
.frame = .{
.id = "TID-STARTUP-B",
.id = "TID-STARTUP",
.loaderId = "LOADERID24DD2FD56CF1EF33C965C79C",
.securityOrigin = URL_BASE,
.url = "about:blank",

View File

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