mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-09 12:51:45 -04:00
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:
12 files changed
+756
-169
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user