@@ -113,15 +113,14 @@ fn createIsolatedWorld(cmd: anytype) !void {
113113 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
114114
115115 try bc .createIsolatedWorld (params .worldName , params .grantUniveralAccess );
116+ const world = & bc .isolated_world .? ;
116117
117118 // Create the auxdata json for the contextCreated event
118119 // Calling contextCreated will assign a Id to the context and send the contextCreated event
119120 const aux_json = try std .fmt .allocPrint (cmd .arena , "{{\" isDefault\" :false,\" type\" :\" isolated\" ,\" frameId\" :\" {s}\" }}" , .{params .frameId });
120- bc .session .inspector .contextCreated (bc . isolated_world .? . executor , bc . isolated_world .? .name , "" , aux_json , false );
121+ bc .session .inspector .contextCreated (world . executor , world .name , "" , aux_json , false );
121122
122- return cmd .sendResult (.{
123- .executionContextId = bc .isolated_world .? .executor .context .debugContextId (),
124- }, .{});
123+ return cmd .sendResult (.{ .executionContextId = world .executor .context .debugContextId () }, .{});
125124}
126125
127126fn navigate (cmd : anytype ) ! void {
@@ -221,17 +220,14 @@ pub fn pageNavigate(bc: anytype, event: *const Notification.PageNavigate) !void
221220 // The client will expect us to send new contextCreated events, such that the client has new id's for the active contexts.
222221 try cdp .sendEvent ("Runtime.executionContextsCleared" , null , .{ .session_id = session_id });
223222
224- if (bc .isolated_world != null ) {
225- const aux_json = try std .fmt .allocPrint (
226- bc .session .arena .allocator (), // TODO change this
227- "{{\" isDefault\" :false,\" type\" :\" isolated\" ,\" frameId\" :\" {s}\" }}" ,
228- .{bc .target_id .? },
229- );
223+ if (bc .isolated_world ) | * isolated_world | {
224+ // TODO change the allocator
225+ const aux_json = try std .fmt .allocPrint (bc .session .arena .allocator (), "{{\" isDefault\" :false,\" type\" :\" isolated\" ,\" frameId\" :\" {s}\" }}" , .{bc .target_id .? });
230226
231227 // Calling contextCreated will assign a new Id to the context and send the contextCreated event
232228 bc .session .inspector .contextCreated (
233- bc . isolated_world .? .executor ,
234- bc . isolated_world .? .name ,
229+ isolated_world .executor ,
230+ isolated_world .name ,
235231 "://" ,
236232 aux_json ,
237233 false ,
0 commit comments