Commit e007774f authored by Mustafa Emre Acer's avatar Mustafa Emre Acer Committed by Commit Bot

Fix crash in lookalike URL navigation observer

LookalikeUrlNavigationObserver uses DidFinishNavigation event to observer
navigations. This event is generated for all frames, so we need a proper
check instead of a DCHECK in it.

Bug: 889815
Change-Id: I699c32e45cc4f538fec515d22b3e5118d89a3d79
Reviewed-on: https://chromium-review.googlesource.com/c/1258062Reviewed-by: default avatarMustafa Emre Acer <meacer@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596027}
parent 82cf3f24
......@@ -58,12 +58,15 @@ LookalikeUrlNavigationObserver::~LookalikeUrlNavigationObserver() {}
void LookalikeUrlNavigationObserver::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
DCHECK(navigation_handle->IsInMainFrame());
// Ignore subframe and same document navigations.
if (!navigation_handle->IsInMainFrame() ||
navigation_handle->IsSameDocument())
return;
// If the navigation was not committed, it means either the page was a
// download or error 204/205, or the navigation never left the previous
// URL. Basically, this isn't a problem since we stayed at the existing URL.
// Also ignore same document navigations.
if (!navigation_handle->HasCommitted() || navigation_handle->IsSameDocument())
if (!navigation_handle->HasCommitted())
return;
const GURL url = navigation_handle->GetURL();
......
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