From 664c2a58603a82cb52056dd3fa3491900d2015f2 Mon Sep 17 00:00:00 2001 From: Szabolcs David <davidsz@inf.u-szeged.hu> Date: Thu, 12 Oct 2017 16:35:05 +0200 Subject: [PATCH] Mark redirecting URLs as visited Store the whole redirect chain of finished navigations in the database of visited links. Chrome does the same thing, except that it implements NavigationURLLoaderDelegate::OnRequestRedirected() for this purpose. Task-number: QTBUG-63579 Change-Id: Iff46c33de14c5e1a7386bd1e2860c832e24d5083 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> --- src/core/web_contents_delegate_qt.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 4bf25ff3b..a997c53de 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -243,9 +243,12 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig return; if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { + BrowserContextAdapter *browserContextAdapter = m_viewClient->browserContextAdapter().data(); // VisistedLinksMaster asserts !IsOffTheRecord(). - if (navigation_handle->ShouldUpdateHistory() && m_viewClient->browserContextAdapter()->trackVisitedLinks()) - m_viewClient->browserContextAdapter()->visitedLinksManager()->addUrl(navigation_handle->GetURL()); + if (navigation_handle->ShouldUpdateHistory() && browserContextAdapter->trackVisitedLinks()) { + for (const GURL &url : navigation_handle->GetRedirectChain()) + browserContextAdapter->visitedLinksManager()->addUrl(url); + } // Make sure that we don't set the findNext WebFindOptions on a new frame. m_lastSearchedString = QString(); -- GitLab