From 2189c8cd8257479708488d6c79c7e05229b68df5 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 16 Feb 2026 17:46:37 +0100 Subject: [PATCH] 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 --- src/browser/Page.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/browser/Page.zig b/src/browser/Page.zig index 3fa7f860..50e81a7b 100644 --- a/src/browser/Page.zig +++ b/src/browser/Page.zig @@ -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.