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

+7 -3
View File
@@ -1518,6 +1518,10 @@ fn drainInbox(self: *Client, mode: DrainMode) !void {
driver.onLink(link);
break :blk false;
},
.bidi_http => |command| blk: {
driver.onHttp(command);
break :blk false;
},
.quit => blk: {
driver.onQuit();
break :blk true; // quit always shutsdown
@@ -1550,14 +1554,14 @@ fn allowDuringSyncWait(msg: *Inbox.Message) bool {
.cdp => |c| isFetchInterceptionMethod(c.input.method),
// BiDi has no request interception yet, so nothing it can send is
// safe to dispatch from inside a JS callback.
.bidi => false,
.bidi, .bidi_http => false,
};
}
fn isTerminal(msg: *Inbox.Message) bool {
return switch (msg.payload) {
.close, .disconnect, .quit => true,
.ping, .cdp, .bidi, .link => false,
.ping, .cdp, .bidi, .link, .bidi_http => false,
};
}
@@ -1575,7 +1579,7 @@ fn isFetchInterceptionMethod(method: []const u8) bool {
fn isSyncWaitInterrupt(msg: *Inbox.Message) bool {
return switch (msg.payload) {
.close, .disconnect, .quit => true,
.ping, .link => false,
.ping, .link, .bidi_http => false,
.cdp => |c| isTeardownMethod(c.input.method),
// Frames aren't parsed on the Network thread for BiDi, so we
// can't spot a teardown command without re-parsing here.