chore: Move ownership of the Inbox from HttpClient to WebSocker Driver

Currently, the HttpClient owns the inbox and its borrowed by the Link. This is
a bit backwards, but it also means that we can't eagerly create a Link: the
Link needs the inbox, so it needs the HttpClient, which is created by the
Browser (which creates an Isolate).

Remember, the Inbox is one of the few things shared between the main thread
and the worker, so either end can own it and the other can borrow it.

This switches the ownership so that the HttpClient now borrows the Inbox from
the Server's side of the Link (the WebSocket).

The main goal of this change is to prepare for more advanced HTTP WebDriver
flows. The more we can create _without_ a Browser, the fewer edge cases we have
to deal with (Browser because it's expensive and has to be created on the
Worker thread due to how V8::Isolate works).
This commit is contained in:
Karl Seguin committed 2026-09-03 16:51:12 +08:00
1 parent cb26e05533
commit 87320a506d
16 files changed
+111 -96

No files matched your search

+1 -1
View File
@@ -43,7 +43,7 @@ pub fn init(self: *ToolSession, app: *App) !void {
self.registry = .init(app.allocator);
errdefer self.registry.deinit();
try self.browser.init(app, .{}, null);
try self.browser.init(app, .{});
errdefer self.browser.deinit();
try self.restartSession();