Repository navigation
fix: keep committed document referrer after aborted navigation on macOS - #4468
EnesKartal wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
[Medium impact] The PR appears safe to merge. Reviews (1) · Last reviewed commit: "fix: keep committed document referrer af..." · Reviewed by Greptile |
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46f30d8182
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private Uri? DocumentReferrer => (_openerPageCommitted ? null : _openerNavigation?.Referrer) | ||
| ?? (_pageDownloadReferrerUncertain ? WebBrowserTabViewModel.BlankPage : _viewModel?.CurrentUri); | ||
| ?? (_pageDownloadReferrerUncertain | ||
| ? (ReportsNavigationCommits ? _viewModel?.CommittedUri : WebBrowserTabViewModel.BlankPage) |
There was a problem hiding this comment.
Preserve native-download retry metadata for typed addresses
On macOS, if a typed URL on site B returns a native download while site A is committed, OnNativeDownloadRequested calls SettleAbortedPageNavigation and queues the response before clearing _pageDownloadReferrerUncertain. This fallback therefore causes BrowserProfile.AddDownload to store A as the download's referrer, even with NoReferrer, instead of the previous null metadata. OnRetryHistoryClick reuses that origin, and BrowserSessionCookies.CreateContainer filters cookies against A, so an authenticated download from B can succeed initially but fail on retry because B's session cookie is omitted. Preserve the native response's direct-navigation metadata while restoring the committed origin for subsequent page links.
Useful? React with 👍 / 👎.
|
@EnesKartal Thanks for your work on this PR! Could you please address the Codex review feedback? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4468 +/- ##
=======================================
Coverage 82.81% 82.82%
=======================================
Files 3320 3320
Lines 296780 296785 +5
Branches 37963 37964 +1
=======================================
+ Hits 245791 245817 +26
+ Misses 39003 38990 -13
+ Partials 11986 11978 -8
... and 17 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Root cause
When a navigation is stopped or fails, SettleAbortedPageNavigation sets _pageDownloadReferrerUncertain and DocumentReferrer falls back to BlankPage, dropping Referer and cookies for subsequent downloads from the displayed page.
On macOS, MacOSBrowserDownloadHandler reports every main-frame commit via OnNativeNavigationCommitted, so WebBrowserTabViewModel.CommittedUri accurately tracks the surviving document (including failures after commit and uncommitted initial tabs).
Fix
eportsNavigationCommits: true in tests), DocumentReferrer resolves uncertain page referrers to _viewModel?.CommittedUri instead of BlankPage, while keeping the attempted address in CurrentUri.
Tests
Fixes #4428
Summary by CodeRabbit