@@ -114,7 +114,7 @@ fn createIsolatedWorld(cmd: anytype) !void {
114114 const bc = cmd .browser_context orelse return error .BrowserContextNotLoaded ;
115115
116116 const world = try bc .createIsolatedWorld (params .worldName , params .grantUniveralAccess );
117- const page = bc .session .currentPage ().? ;
117+ const page = bc .session .currentPage () orelse return error . PageNotLoaded ;
118118 try pageCreated (bc , page );
119119 const scope = world .scope .? ;
120120
@@ -147,7 +147,7 @@ fn navigate(cmd: anytype) !void {
147147
148148 const url = try URL .parse (params .url , "https" );
149149
150- var page = bc .session .currentPage ().? ;
150+ var page = bc .session .currentPage () orelse return error . PageNotLoaded ;
151151 bc .loader_id = bc .cdp .loader_id_gen .next ();
152152 try cmd .sendResult (.{
153153 .frameId = target_id ,
@@ -223,7 +223,7 @@ pub fn pageNavigate(bc: anytype, event: *const Notification.PageNavigate) !void
223223 var buffer : [512 ]u8 = undefined ;
224224 {
225225 var fba = std .heap .FixedBufferAllocator .init (& buffer );
226- const page = bc .session .currentPage ().? ;
226+ const page = bc .session .currentPage () orelse return error . PageNotLoaded ;
227227 const aux_data = try std .fmt .allocPrint (fba .allocator (), "{{\" isDefault\" :true,\" type\" :\" default\" ,\" frameId\" :\" {s}\" }}" , .{target_id });
228228 bc .inspector .contextCreated (
229229 page .scope ,
@@ -249,7 +249,7 @@ pub fn pageNavigate(bc: anytype, event: *const Notification.PageNavigate) !void
249249pub fn pageRemove (bc : anytype ) ! void {
250250 // The main page is going to be removed, we need to remove contexts from other worlds first.
251251 if (bc .isolated_world ) | * isolated_world | {
252- isolated_world .removeContext ();
252+ try isolated_world .removeContext ();
253253 }
254254}
255255
0 commit comments