cdp: fix some id inconsitency accross runtime messages

This commit is contained in:
Pierre Tachoire
2024-12-18 16:54:01 +01:00
parent bcaace1c91
commit 8e2cb36597
4 changed files with 13 additions and 10 deletions

View File

@@ -138,7 +138,7 @@ fn setAutoAttach(
.sessionId = cdp.BrowserSessionID,
.targetInfo = .{
.targetId = PageTargetID,
.title = "New Incognito tab",
.title = "about:blank",
.url = cdp.URLBase,
.browserContextId = BrowserContextID,
},
@@ -171,8 +171,8 @@ fn attachToTarget(
const attached = AttachToTarget{
.sessionId = cdp.BrowserSessionID,
.targetInfo = .{
.targetId = PageTargetID,
.title = "New Incognito tab",
.targetId = input.params.targetId,
.title = "about:blank",
.url = cdp.URLBase,
.browserContextId = BrowserContextID,
},
@@ -185,7 +185,7 @@ fn attachToTarget(
sessionId: []const u8,
};
const output = SessionId{
.sessionId = input.sessionId orelse BrowserContextID,
.sessionId = input.sessionId orelse cdp.BrowserSessionID,
};
return result(alloc, input.id, SessionId, output, null);
}
@@ -342,6 +342,7 @@ fn createTarget(
ctx.state.securityOrigin = "://";
ctx.state.secureContextType = "InsecureScheme";
ctx.state.loaderID = LoaderID;
ctx.state.sessionID = msg.sessionId;
// send targetCreated event
const created = TargetCreated{
@@ -361,9 +362,10 @@ fn createTarget(
.sessionId = cdp.ContextSessionID,
.targetInfo = .{
.targetId = ctx.state.frameID,
.title = "",
.title = "about:blank",
.url = ctx.state.url,
.browserContextId = input.params.browserContextId orelse ContextID,
.attached = true,
},
.waitingForDebugger = true,
};