Commit 6afb5772 authored by Eugene But's avatar Eugene But Committed by Commit Bot

[ios] Fix logic for hiding navigation in history

Update |hidden| argument calculations as follows:
 - Remove GetError() check, because same check was made earlier in the
   method and results in early return
 - Remove "is main frame" check as unnecessary, because
   DidFinishNavigation is not called for iframe
 - Remove navigation_context->GetResponseHeaders()->response_code() > 600
   check, as it looks like a mistake which overrides correct comparison
   to status code 400 (range of HTTP status codes is [100, 599]).

Bug: 924298
Change-Id: I0dc570d34ef6aed0654f7d0742190f425b2ac966
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2535017
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827031}
parent 16ab8cf3
...@@ -165,18 +165,13 @@ void HistoryTabHelper::DidFinishNavigation( ...@@ -165,18 +165,13 @@ void HistoryTabHelper::DidFinishNavigation(
!content_suggestions_navigation && !content_suggestions_navigation &&
referrer_url != kReadingListReferrerURL; referrer_url != kReadingListReferrerURL;
// Top-level frame navigations are visible; everything else is hidden. // Hide navigations that result in an error in order to prevent the omnibox
// Also hide top-level navigations that result in an error in order to // from suggesting URLs that have never been navigated to successfully.
// prevent the omnibox from suggesting URLs that have never been navigated // (If a navigation to the URL succeeds at some point, the URL will be
// to successfully. (If a top-level navigation to the URL succeeds at some // unhidden and thus eligible to be suggested by the omnibox.)
// point, the URL will be unhidden and thus eligible to be suggested by the
// omnibox.)
const bool hidden = const bool hidden =
navigation_context->GetError() ||
(navigation_context->GetResponseHeaders() && (navigation_context->GetResponseHeaders() &&
navigation_context->GetResponseHeaders()->response_code() >= 400 && navigation_context->GetResponseHeaders()->response_code() >= 400);
navigation_context->GetResponseHeaders()->response_code() > 600) ||
!ui::PageTransitionIsMainFrame(navigation_context->GetPageTransition());
history::HistoryAddPageArgs add_page_args( history::HistoryAddPageArgs add_page_args(
url, last_committed_item->GetTimestamp(), this, url, last_committed_item->GetTimestamp(), this,
last_committed_item->GetUniqueID(), referrer_url, redirects, transition, last_committed_item->GetUniqueID(), referrer_url, redirects, transition,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment