WebDriver: add navigate

This feature is significant because it adds support for processing an HTTP
request via the worker. It requires parking the connection and then having the
worker notify the loop when the response is ready. A lot of this was already
in-place (e.g. worker -> loop notification) but not quite do this extent.
This commit is contained in:
Karl Seguin committed 2026-09-16 14:05:49 +08:00
1 parent d52957b2e2
commit 7ecefa9e92
12 files changed
+756 -169

No files matched your search

+13
View File
@@ -27,6 +27,7 @@ const Link = @import("Link.zig");
const CDP = @import("cdp/CDP.zig");
const BiDi = @import("bidi/BiDi.zig");
const http_command = @import("bidi/http_command.zig");
const log = lp.log;
@@ -122,6 +123,18 @@ pub fn onLink(self: *const Driver, l: *Link) void {
}
}
// Worker Thread. An HTTP WebDriver command; its connection waits on our answer.
pub fn onHttp(self: *const Driver, command: http_command.Command) void {
switch (self.impl) {
.bidi => |bidi| bidi.onHttpCommand(command),
.cdp => {
if (comptime lp.IS_DEBUG) {
lp.assert(false, "Driver.onHttp cdp", .{});
}
},
}
}
// Worker Thread. The websocket is closing. Should we kill the worker? That's
// up to the implementation (hint: for CDP, it's always "yes" and for WebDriver
// it's "yes" for a BiDi-only session)