mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 12:44:43 +00:00
Use per-cdp connection HttpClient
This commit is contained in:
@@ -28,6 +28,7 @@ const js = @import("../browser/js/js.zig");
|
||||
const App = @import("../App.zig");
|
||||
const Browser = @import("../browser/Browser.zig");
|
||||
const Session = @import("../browser/Session.zig");
|
||||
const HttpClient = @import("../http/Client.zig");
|
||||
const Page = @import("../browser/Page.zig");
|
||||
const Incrementing = @import("../id.zig").Incrementing;
|
||||
const Notification = @import("../Notification.zig");
|
||||
@@ -84,10 +85,11 @@ pub fn CDPT(comptime TypeProvider: type) type {
|
||||
|
||||
const Self = @This();
|
||||
|
||||
pub fn init(app: *App, client: TypeProvider.Client) !Self {
|
||||
pub fn init(app: *App, http_client: *HttpClient, client: TypeProvider.Client) !Self {
|
||||
const allocator = app.allocator;
|
||||
const browser = try Browser.init(app, .{
|
||||
.env = .{ .with_inspector = true },
|
||||
.http_client = http_client,
|
||||
});
|
||||
errdefer browser.deinit();
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ const TestContext = struct {
|
||||
self.client = Client.init(self.arena.allocator());
|
||||
// Don't use the arena here. We want to detect leaks in CDP.
|
||||
// The arena is only for test-specific stuff
|
||||
self.cdp_ = TestCDP.init(base.test_app, &self.client.?) catch unreachable;
|
||||
self.cdp_ = TestCDP.init(base.test_app, base.test_http, &self.client.?) catch unreachable;
|
||||
}
|
||||
return &self.cdp_.?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user