Fully fake contextCreated

emit contextCreated when it's needed, not when it actually happens.

I thought we could make this sync-up, but we'd need to create 3 contexts to
satisfy both puppeteer and chromedp. So rather than having it partially
driven by notifications from Browser, I rather just fake it all for now.
This commit is contained in:
Karl Seguin
2025-04-29 13:29:42 +08:00
parent 2e01fa738a
commit 7309fec51d
5 changed files with 30 additions and 30 deletions

View File

@@ -125,7 +125,18 @@ fn createTarget(cmd: anytype) !void {
try bc.createIsolatedWorld();
bc.target_id = target_id;
_ = try bc.session.createPage();
const page = try bc.session.createPage();
{
const aux_data = try std.fmt.allocPrint(cmd.arena, "{{\"isDefault\":true,\"type\":\"default\",\"frameId\":\"{s}\"}}", .{target_id});
bc.inspector.contextCreated(
page.scope,
"",
try page.origin(cmd.arena),
aux_data,
true,
);
}
// change CDP state
bc.security_origin = "://";