Skip to content

Commit

Permalink
Only add navigations that affect user-facing history to visited URLs.
Browse files Browse the repository at this point in the history
We want to avoid adding anything that isn't in the primary page
to the visited URLs. So fenced frames won't count as a visited URL navigation.

BUG=1218946

Change-Id: If8bba1bedda2e96c7d97731f5b237c80c6e3f660
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3749037
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1021273}
  • Loading branch information
dtapuska authored and Chromium LUCI CQ committed Jul 6, 2022
1 parent eb1aba0 commit a87fbb5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions android_webview/browser/renderer_host/aw_render_view_host_ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,19 @@ void AwRenderViewHostExt::DidStartNavigation(
void AwRenderViewHostExt::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!navigation_handle->HasCommitted() ||
(!navigation_handle->IsInMainFrame() &&
!navigation_handle->HasSubframeNavigationEntryCommitted()))

if (!navigation_handle->HasCommitted())
return;

AwBrowserContext::FromWebContents(web_contents())
->AddVisitedURLs(navigation_handle->GetRedirectChain());
// Only record a visit if the navigation affects user-facing session history
// (i.e. it occurs in the primary frame tree).
if (navigation_handle->IsInPrimaryMainFrame() ||
(navigation_handle->GetParentFrame() &&
navigation_handle->GetParentFrame()->GetPage().IsPrimary() &&
navigation_handle->HasSubframeNavigationEntryCommitted())) {
AwBrowserContext::FromWebContents(web_contents())
->AddVisitedURLs(navigation_handle->GetRedirectChain());
}
}

void AwRenderViewHostExt::OnPageScaleFactorChanged(float page_scale_factor) {
Expand Down

0 comments on commit a87fbb5

Please sign in to comment.