Commit 61ea83df authored by yzshen's avatar yzshen Committed by Commit bot

SearchEngineTabHelper: avoid calling TemplateURL::GenerateFaviconURL with empty URL.

In some cases, it tried to generate favicon URL using the referrer URL of a
navigation, but referrer URL could be empty which triggered a DCHECK in
TemplateURL::GenerateFaviconURL.

BUG=678502

Review-Url: https://codereview.chromium.org/2624263002
Cr-Commit-Position: refs/heads/master@{#443017}
parent 3a6eca3c
...@@ -214,10 +214,12 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary( ...@@ -214,10 +214,12 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary(
// latter. // latter.
// TODO(sky): Need a way to set the favicon that doesn't involve generating // TODO(sky): Need a way to set the favicon that doesn't involve generating
// its url. // its url.
data.favicon_url = if (current_favicon.is_valid()) {
current_favicon.is_valid() data.favicon_url = current_favicon;
? current_favicon } else if (handle->GetReferrer().url.is_valid()) {
: TemplateURL::GenerateFaviconURL(handle->GetReferrer().url); data.favicon_url =
TemplateURL::GenerateFaviconURL(handle->GetReferrer().url);
}
data.safe_for_autoreplace = true; data.safe_for_autoreplace = true;
data.input_encodings.push_back(handle->GetSearchableFormEncoding()); data.input_encodings.push_back(handle->GetSearchableFormEncoding());
url_service->Add(base::MakeUnique<TemplateURL>(data)); url_service->Add(base::MakeUnique<TemplateURL>(data));
......
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