mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
send Target.attachedToTarget after Target.setAutoAttach
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -5,6 +5,7 @@ const Ctx = server.CmdContext;
|
|||||||
const SendFn = server.SendFn;
|
const SendFn = server.SendFn;
|
||||||
const result = @import("cdp.zig").result;
|
const result = @import("cdp.zig").result;
|
||||||
const getParams = @import("cdp.zig").getParams;
|
const getParams = @import("cdp.zig").getParams;
|
||||||
|
const stringify = @import("cdp.zig").stringify;
|
||||||
|
|
||||||
const TargetMethods = enum {
|
const TargetMethods = enum {
|
||||||
setAutoAttach,
|
setAutoAttach,
|
||||||
@@ -27,11 +28,15 @@ pub fn target(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SessionID = "9559320D92474062597D9875C664CAC0";
|
||||||
|
const TargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
|
||||||
|
const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9";
|
||||||
|
|
||||||
fn tagetSetAutoAttach(
|
fn tagetSetAutoAttach(
|
||||||
alloc: std.mem.Allocator,
|
alloc: std.mem.Allocator,
|
||||||
id: u64,
|
id: u64,
|
||||||
scanner: *std.json.Scanner,
|
scanner: *std.json.Scanner,
|
||||||
_: *Ctx,
|
ctx: *Ctx,
|
||||||
) ![]const u8 {
|
) ![]const u8 {
|
||||||
const Params = struct {
|
const Params = struct {
|
||||||
autoAttach: bool,
|
autoAttach: bool,
|
||||||
@@ -40,11 +45,29 @@ fn tagetSetAutoAttach(
|
|||||||
};
|
};
|
||||||
const params = try getParams(alloc, Params, scanner);
|
const params = try getParams(alloc, Params, scanner);
|
||||||
std.log.debug("params {any}", .{params});
|
std.log.debug("params {any}", .{params});
|
||||||
|
|
||||||
|
const AttachToTarget = struct {
|
||||||
|
method: []const u8 = "Target.attachedToTarget",
|
||||||
|
params: struct {
|
||||||
|
sessionId: []const u8 = SessionID,
|
||||||
|
targetInfo: struct {
|
||||||
|
targetId: []const u8 = TargetID,
|
||||||
|
type: []const u8 = "page",
|
||||||
|
title: []const u8 = "New Incognito tab",
|
||||||
|
url: []const u8 = "chrome://newtab/",
|
||||||
|
attached: bool = true,
|
||||||
|
canAccessOpener: bool = false,
|
||||||
|
browserContextId: []const u8 = BrowserContextID,
|
||||||
|
} = .{},
|
||||||
|
waitingForDebugger: bool = false,
|
||||||
|
} = .{},
|
||||||
|
};
|
||||||
|
const attached = try stringify(alloc, AttachToTarget{});
|
||||||
|
try server.sendLater(ctx, attached, 0);
|
||||||
|
|
||||||
return result(alloc, id, null, null);
|
return result(alloc, id, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
|
|
||||||
|
|
||||||
fn tagetGetTargetInfo(
|
fn tagetGetTargetInfo(
|
||||||
alloc: std.mem.Allocator,
|
alloc: std.mem.Allocator,
|
||||||
id: u64,
|
id: u64,
|
||||||
|
|||||||
Reference in New Issue
Block a user