mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 07:31:47 +00:00
Re-enable telemetry
Start work on supporting navigation events (clicks, form submission).
This commit is contained in:
@@ -104,6 +104,7 @@ pub fn CDPT(comptime TypeProvider: type) type {
|
||||
pub fn handleMessage(self: *Self, msg: []const u8) bool {
|
||||
// if there's an error, it's already been logged
|
||||
self.processMessage(msg) catch return false;
|
||||
self.pageWait();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -113,6 +114,22 @@ pub fn CDPT(comptime TypeProvider: type) type {
|
||||
return self.dispatch(arena.allocator(), self, msg);
|
||||
}
|
||||
|
||||
// @newhttp
|
||||
// A bit hacky right now. The main server loop blocks only for CDP
|
||||
// messages. It no longer blocks for page timeouts of page HTTP
|
||||
// transfers. So we need to call this more ourselves.
|
||||
// This is called after every message and [very hackily] from the server
|
||||
// loop.
|
||||
// This is hopefully temporary.
|
||||
pub fn pageWait(self: *Self) void {
|
||||
const session = &(self.browser.session orelse return);
|
||||
var page = session.currentPage() orelse return;
|
||||
|
||||
// exits early if there's nothing to do, so a large value like
|
||||
// 5 seconds should be ok
|
||||
page.wait(5);
|
||||
}
|
||||
|
||||
// Called from above, in processMessage which handles client messages
|
||||
// but can also be called internally. For example, Target.sendMessageToTarget
|
||||
// calls back into dispatch to capture the response.
|
||||
|
||||
@@ -155,7 +155,6 @@ fn navigate(cmd: anytype) !void {
|
||||
.reason = .address_bar,
|
||||
.cdp_id = cmd.input.id,
|
||||
});
|
||||
try page.wait(5);
|
||||
}
|
||||
|
||||
pub fn pageNavigate(arena: Allocator, bc: anytype, event: *const Notification.PageNavigate) !void {
|
||||
|
||||
Reference in New Issue
Block a user