Index: components/favicon/core/favicon_driver_impl.cc |
diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc |
index 8135922832521166f1f7b34559f975c447d10da4..8896bd859360bc06f0c1e3e46deb317720b20a0a 100644 |
--- a/components/favicon/core/favicon_driver_impl.cc |
+++ b/components/favicon/core/favicon_driver_impl.cc |
@@ -98,9 +98,17 @@ bool FaviconDriverImpl::IsBookmarked(const GURL& url) { |
return bookmark_model_ && bookmark_model_->IsBookmarked(url); |
} |
-void FaviconDriverImpl::OnFaviconAvailable(const gfx::Image& image, |
+void FaviconDriverImpl::OnFaviconAvailable(const GURL& page_url, |
const GURL& icon_url, |
+ const gfx::Image& image, |
bool is_active_favicon) { |
+ // Check whether the active URL has changed since FetchFavicon() was called. |
+ // On iOS only, the active URL can change between calls to FetchFavicon(). |
+ // For instance, FetchFavicon() is not synchronously called when the active |
+ // URL changes as a result of CRWSessionController::goToEntry(). |
+ if (page_url != GetActiveURL()) |
+ return; |
+ |
if (is_active_favicon) { |
bool icon_url_changed = GetActiveFaviconURL() != icon_url; |
// No matter what happens, we need to mark the favicon as being set. |
@@ -141,13 +149,14 @@ void FaviconDriverImpl::SetFaviconOutOfDateForPage(const GURL& url, |
} |
void FaviconDriverImpl::OnUpdateFaviconURL( |
+ const GURL& page_url, |
const std::vector<FaviconURL>& candidates) { |
DCHECK(!candidates.empty()); |
- favicon_handler_->OnUpdateFaviconURL(candidates); |
+ favicon_handler_->OnUpdateFaviconURL(page_url, candidates); |
if (touch_icon_handler_.get()) |
- touch_icon_handler_->OnUpdateFaviconURL(candidates); |
+ touch_icon_handler_->OnUpdateFaviconURL(page_url, candidates); |
if (large_icon_handler_.get()) |
- large_icon_handler_->OnUpdateFaviconURL(candidates); |
+ large_icon_handler_->OnUpdateFaviconURL(page_url, candidates); |
} |
} // namespace favicon |