dispatch .page_navigated event on page error callback

When a CDP client navigates to a page and the page generates an error,
it blocks waiting for the .page_navigated event.

It currently happens w/ robots.txt denied page.
Example: https://httpbin.io/deny
This commit is contained in:
Pierre Tachoire
2026-02-16 17:46:37 +01:00
parent 3de9267ea7
commit 2189c8cd82

View File

@@ -799,6 +799,14 @@ fn pageErrorCallback(ctx: *anyopaque, err: anyerror) void {
var self: *Page = @ptrCast(@alignCast(ctx));
self.clearTransferArena();
self._parse_state = .{ .err = err };
// Dispatch a navigated event to indicate the end of the navigation.
self._session.notification.dispatch(.page_navigated, &.{
.req_id = self._req_id.?,
.opts = self._navigated_options.?,
.url = self.url,
.timestamp = timestamp(.monotonic),
});
}
// The transfer arena is useful and interesting, but has a weird lifetime.