diff --git a/src/cdp/cdp.zig b/src/cdp/cdp.zig index c70afcc0..83b2a925 100644 --- a/src/cdp/cdp.zig +++ b/src/cdp/cdp.zig @@ -367,7 +367,7 @@ pub fn BrowserContext(comptime CDP_T: type) type { self.node_search_list.reset(); } - pub fn createIsolatedWorld(self: *Self, page: *Page, world_name: []const u8, grant_universal_access: bool) !*IsolatedWorld { + pub fn createIsolatedWorld(self: *Self, world_name: []const u8, grant_universal_access: bool) !*IsolatedWorld { if (self.isolated_world != null) { return error.CurrentlyOnly1IsolatedWorldSupported; } @@ -381,9 +381,7 @@ pub fn BrowserContext(comptime CDP_T: type) type { .executor = executor, .grant_universal_access = grant_universal_access, }; - const world = &self.isolated_world.?; - try world.createContext(page); - return world; + return &self.isolated_world.?; } pub fn nodeWriter(self: *Self, node: *const Node, opts: Node.Writer.Opts) Node.Writer { diff --git a/src/cdp/domains/page.zig b/src/cdp/domains/page.zig index 892360be..4ec5bdf7 100644 --- a/src/cdp/domains/page.zig +++ b/src/cdp/domains/page.zig @@ -113,8 +113,9 @@ fn createIsolatedWorld(cmd: anytype) !void { } const bc = cmd.browser_context orelse return error.BrowserContextNotLoaded; + const world = try bc.createIsolatedWorld(params.worldName, params.grantUniveralAccess); const page = bc.session.currentPage().?; - const world = try bc.createIsolatedWorld(page, params.worldName, params.grantUniveralAccess); + try pageCreated(bc, page); const scope = world.scope.?; // Create the auxdata json for the contextCreated event