mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
Anchor click, form submit, and `location.href = ...` assignments queue a navigation through `Frame.scheduleNavigation`, which then tears down the originating page and rebuilds the frame in `Session.processRootQueuedNavigation` before `Frame.navigate` issues the HTTP request. The originator's URL was discarded with the old arena, so the request went out without a Referer header — even though the HTML "navigate" algorithm and Fetch §4.5 require one. `Frame.headersForRequest` (#1449) handled subresource fetches but was never called from the navigation path. Capture the originating frame's URL into a new `referer` field on `NavigateOpts` at scheduling time, dup'd into the `QueuedNavigation` arena so it survives the page tear-down. `Frame.navigate` adds it as a `Referer:` header alongside the existing per-request headers. Iframe initial navigation (`Frame.zig:1282`) also sets `referer = parent.url` since the parent frame outlives that direct `navigate` call. CDP `Page.navigate` (`.reason = .address_bar`) and `Page.reload` continue to omit Referer — matches Chrome. Closes #2281
24 KiB
24 KiB