@@ -39,18 +39,23 @@ pub fn target(
3939 };
4040}
4141
42+ // TODO: hard coded IDs
4243const PageTargetID = "CFCD6EC01573CF29BB638E9DC0F52DDC" ;
4344const BrowserTargetID = "2d2bdef9-1c95-416f-8c0e-83f3ab73a30c" ;
4445const BrowserContextID = "65618675CB7D3585A95049E9DFE95EA9" ;
4546
47+ // TODO: noop method
4648fn setDiscoverTargets (
4749 alloc : std.mem.Allocator ,
4850 id : ? u16 ,
4951 scanner : * std.json.Scanner ,
5052 _ : * Ctx ,
5153) ! []const u8 {
54+
55+ // input
5256 const msg = try getMsg (alloc , void , scanner );
5357
58+ // output
5459 return result (alloc , id orelse msg .id .? , null , null , msg .sessionID );
5560}
5661
@@ -73,6 +78,7 @@ const TargetFilter = struct {
7378 exclude : ? bool = null ,
7479};
7580
81+ // TODO: noop method
7682fn setAutoAttach (
7783 alloc : std.mem.Allocator ,
7884 id : ? u16 ,
@@ -90,6 +96,7 @@ fn setAutoAttach(
9096 const msg = try getMsg (alloc , Params , scanner );
9197 std .log .debug ("params {any}" , .{msg .params });
9298
99+ // attachedToTarget event
93100 if (msg .sessionID == null ) {
94101 const attached = AttachToTarget {
95102 .sessionId = cdp .BrowserSessionID ,
@@ -103,6 +110,7 @@ fn setAutoAttach(
103110 try cdp .sendEvent (alloc , ctx , "Target.attachedToTarget" , AttachToTarget , attached , null );
104111 }
105112
113+ // output
106114 return result (alloc , id orelse msg .id .? , null , null , msg .sessionID );
107115}
108116
@@ -142,12 +150,15 @@ fn getTargetInfo(
142150// Browser context are not handled and not in the roadmap for now
143151// The following methods are "fake"
144152
153+ // TODO: noop method
145154fn getBrowserContexts (
146155 alloc : std.mem.Allocator ,
147156 id : ? u16 ,
148157 scanner : * std.json.Scanner ,
149158 ctx : * Ctx ,
150159) ! []const u8 {
160+
161+ // input
151162 const msg = try getMsg (alloc , void , scanner );
152163
153164 // ouptut
@@ -167,6 +178,7 @@ fn getBrowserContexts(
167178
168179const ContextID = "22648B09EDCCDD11109E2D4FEFBE4F89" ;
169180
181+ // TODO: noop method
170182fn createBrowserContext (
171183 alloc : std.mem.Allocator ,
172184 id : ? u16 ,
@@ -205,10 +217,13 @@ fn disposeBrowserContext(
205217 };
206218 const msg = try getMsg (alloc , Params , scanner );
207219
220+ // output
208221 return result (alloc , id orelse msg .id .? , null , {}, null );
209222}
210223
224+ // TODO: hard coded IDs
211225const TargetID = "57356548460A8F29706A2ADF14316298" ;
226+ const LoaderID = "DD4A76F842AA389647D702B4D805F49A" ;
212227
213228fn createTarget (
214229 alloc : std.mem.Allocator ,
@@ -235,7 +250,7 @@ fn createTarget(
235250 ctx .state .url = "about:blank" ;
236251 ctx .state .securityOrigin = "://" ;
237252 ctx .state .secureContextType = "InsecureScheme" ;
238- ctx .state .loaderID = "DD4A76F842AA389647D702B4D805F49A" ;
253+ ctx .state .loaderID = LoaderID ;
239254
240255 // send attachToTarget event
241256 const attached = AttachToTarget {
@@ -277,7 +292,7 @@ fn closeTarget(
277292 const res = try result (alloc , id orelse msg .id .? , Resp , Resp {}, null );
278293 try server .sendSync (ctx , res );
279294
280- // events
295+ // Inspector.detached event
281296 const InspectorDetached = struct {
282297 reason : []const u8 = "Render process gone." ,
283298 };
@@ -290,6 +305,7 @@ fn closeTarget(
290305 msg .sessionID orelse cdp .ContextSessionID ,
291306 );
292307
308+ // detachedFromTarget event
293309 const TargetDetached = struct {
294310 sessionId : []const u8 ,
295311 targetId : []const u8 ,
0 commit comments