cdp: use an enum for SessionID

This commit is contained in:
Pierre Tachoire
2025-01-29 18:38:05 +01:00
parent a74c9e8481
commit 6d530691f3
4 changed files with 30 additions and 6 deletions

View File

@@ -344,7 +344,13 @@ fn createTarget(
ctx.state.securityOrigin = "://";
ctx.state.secureContextType = "InsecureScheme";
ctx.state.loaderID = LoaderID;
ctx.state.sessionID = msg.sessionId;
if (msg.sessionId) |s| {
ctx.state.sessionID = cdp.SessionID.parse(s) catch |err| {
log.err("parse sessionID: {s} {any}", .{ s, err });
return err;
};
}
// TODO stop the previous page instead?
if (ctx.browser.session.page != null) return error.pageAlreadyExists;