@@ -8,6 +8,8 @@ const getParams = cdp.getParams;
88const stringify = cdp .stringify ;
99const sendEvent = cdp .sendEvent ;
1010
11+ const Runtime = @import ("runtime.zig" );
12+
1113const PageMethods = enum {
1214 enable ,
1315 getFrameTree ,
@@ -212,6 +214,9 @@ fn navigate(
212214 std .log .debug ("res {s}" , .{res });
213215 try server .sendSync (ctx , res );
214216
217+ // Runtime.executionContextsCleared event
218+ try sendEvent (alloc , ctx , "Runtime.executionContextsCleared" , void , {}, sessionID );
219+
215220 // launch navigate
216221 var p = try ctx .browser .currentSession ().createPage ();
217222 _ = try p .navigate (input .params .url );
@@ -237,6 +242,28 @@ fn navigate(
237242 try sendEvent (alloc , ctx , "Page.lifecycleEvent" , LifecycleEvent , life_event , sessionID );
238243 }
239244
245+ try Runtime .executionContextCreated (
246+ alloc ,
247+ ctx ,
248+ 3 ,
249+ "http://127.0.0.1:1234" ,
250+ "" ,
251+ "7102379147004877974.3265385113993241162" ,
252+ .{ .frameId = ctx .state .frameID },
253+ sessionID ,
254+ );
255+
256+ try Runtime .executionContextCreated (
257+ alloc ,
258+ ctx ,
259+ 4 ,
260+ "://" ,
261+ "__playwright_utility_world__" ,
262+ "-4572718120346458707.6016875269626438350" ,
263+ .{ .isDefault = false , .type = "isolated" , .frameId = ctx .state .frameID },
264+ sessionID ,
265+ );
266+
240267 // domContentEventFired event
241268 ts_event = .{ .timestamp = 343721.803338 };
242269 try sendEvent (alloc , ctx , "Page.domContentEventFired" , cdp .TimestampEvent , ts_event , sessionID );
0 commit comments