load polyfills on creation

This commit is contained in:
sjorsdonkers
2025-05-02 11:04:55 +02:00
parent 8930e2f06e
commit cddc55694a
2 changed files with 4 additions and 5 deletions

View File

@@ -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 {

View File

@@ -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