Commit 1b6cda4e authored by Yi Su's avatar Yi Su Committed by Commit Bot

Add last committed item URL validity check in SearchEngineTabHelper.

This CL adds a validity check for FaviconDriver::GetActiveURL().
GetActiveURL() depends on GetLastCommittedItem, and can be nil at various
times -- such as during session restore on startup.

Bug: 908240
Change-Id: I32bcf8e93b862fd87ae22bce6c59cbb9c4ba2f5d
Reviewed-on: https://chromium-review.googlesource.com/c/1350873Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Yi Su <mrsuyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612263}
parent 587a3c48
......@@ -105,8 +105,9 @@ void SearchEngineTabHelper::OnFaviconUpdated(
ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState());
TemplateURLService* url_service =
ios::TemplateURLServiceFactory::GetForBrowserState(browser_state);
if (url_service && url_service->loaded())
url_service->UpdateProviderFavicons(driver->GetActiveURL(), icon_url);
const GURL potential_search_url = driver->GetActiveURL();
if (url_service && url_service->loaded() && potential_search_url.is_valid())
url_service->UpdateProviderFavicons(potential_search_url, icon_url);
}
// When the page is loaded, checks if |searchable_url_| has a value generated
......
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