@@ -8,6 +8,7 @@ const getMsg = cdp.getMsg;
88const stringify = cdp .stringify ;
99
1010const TargetMethods = enum {
11+ setDiscoverTargets ,
1112 setAutoAttach ,
1213 getTargetInfo ,
1314 getBrowserContexts ,
@@ -25,6 +26,7 @@ pub fn target(
2526 const method = std .meta .stringToEnum (TargetMethods , action ) orelse
2627 return error .UnknownMethod ;
2728 return switch (method ) {
29+ .setDiscoverTargets = > targetSetDiscoverTargets (alloc , id , scanner , ctx ),
2830 .setAutoAttach = > tagetSetAutoAttach (alloc , id , scanner , ctx ),
2931 .getTargetInfo = > tagetGetTargetInfo (alloc , id , scanner , ctx ),
3032 .getBrowserContexts = > getBrowserContexts (alloc , id , scanner , ctx ),
@@ -37,6 +39,17 @@ const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC";
3739const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c" ;
3840const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9" ;
3941
42+ fn targetSetDiscoverTargets (
43+ alloc : std.mem.Allocator ,
44+ id : ? u16 ,
45+ scanner : * std.json.Scanner ,
46+ _ : * Ctx ,
47+ ) ! []const u8 {
48+ const msg = try getMsg (alloc , void , scanner );
49+
50+ return result (alloc , id orelse msg .id .? , null , null , msg .sessionID );
51+ }
52+
4053const AttachToTarget = struct {
4154 sessionId : []const u8 ,
4255 targetInfo : struct {
@@ -52,8 +65,8 @@ const AttachToTarget = struct {
5265};
5366
5467const TargetFilter = struct {
55- type : []const u8 ,
56- exclude : bool ,
68+ type : ? []const u8 = null ,
69+ exclude : ? bool = null ,
5770};
5871
5972fn tagetSetAutoAttach (
0 commit comments