mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
emit context created on createTarget event for chromedp
This commit is contained in:
@@ -404,8 +404,8 @@ pub fn BrowserContext(comptime CDP_T: type) type {
|
||||
const self: *Self = @alignCast(@ptrCast(ctx));
|
||||
|
||||
switch (notification.*) {
|
||||
.context_created => |cc| {
|
||||
const aux_data = try std.fmt.allocPrint(self.arena, "{{\"isDefault\":true,\"type\":\"default\",\"frameId\":\"{s}\"}}", .{self.target_id.?});
|
||||
.context_created => |cc| if (self.target_id) |target_id| {
|
||||
const aux_data = try std.fmt.allocPrint(self.arena, "{{\"isDefault\":true,\"type\":\"default\",\"frameId\":\"{s}\"}}", .{target_id});
|
||||
self.inspector.contextCreated(
|
||||
self.session.page.?.scope,
|
||||
"",
|
||||
|
||||
@@ -123,6 +123,7 @@ fn createTarget(cmd: anytype) !void {
|
||||
const target_id = cmd.cdp.target_id_gen.next();
|
||||
|
||||
try bc.createIsolatedWorld();
|
||||
bc.target_id = target_id;
|
||||
|
||||
_ = try bc.session.createPage();
|
||||
|
||||
@@ -149,8 +150,6 @@ fn createTarget(cmd: anytype) !void {
|
||||
try doAttachtoTarget(cmd, target_id);
|
||||
}
|
||||
|
||||
bc.target_id = target_id;
|
||||
|
||||
try cmd.sendResult(.{
|
||||
.targetId = target_id,
|
||||
}, .{});
|
||||
|
||||
Reference in New Issue
Block a user