From 4c0ecfb7cb89164de11fcd8b0455e7ca45fdc28b Mon Sep 17 00:00:00 2001 From: "sspitzer%mozilla.org" Date: Fri, 7 Sep 2007 23:18:23 +0000 Subject: [PATCH] fix for bug #395445: Tag and Star icon both show for Location bar entries r=dietrich, a=mconnor for m8 git-svn-id: svn://10.0.0.236/trunk@235396 18797224-902f-48f8-a5cc-f745e15eee43 --- .../places/src/nsNavHistoryAutoComplete.cpp | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/mozilla/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp b/mozilla/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp index cbedb9eccbc..9f8b90ddcdc 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp +++ b/mozilla/toolkit/components/places/src/nsNavHistoryAutoComplete.cpp @@ -331,22 +331,28 @@ nsNavHistory::StartSearch(const nsAString & aSearchString, nsAutoString style; aPreviousResult->GetStyleAt(i, style); if (!style.Equals(NS_LITERAL_STRING("tag"))) { - nsAutoString url, title; + nsAutoString url; aPreviousResult->GetValueAt(i, url); - aPreviousResult->GetCommentAt(i, title); - PRBool isMatch = CaseInsensitiveFindInReadable(mCurrentSearchString, url); - if (!isMatch) - isMatch = CaseInsensitiveFindInReadable(mCurrentSearchString, title); + // make sure the url isn't already listed, as a tag result + PRBool dummy; + if (!mCurrentResultURLs.Get(url, &dummy)) { + nsAutoString title; + aPreviousResult->GetCommentAt(i, title); - if (isMatch) { - nsAutoString image; - aPreviousResult->GetImageAt(i, image); + PRBool isMatch = CaseInsensitiveFindInReadable(mCurrentSearchString, url); + if (!isMatch) + isMatch = CaseInsensitiveFindInReadable(mCurrentSearchString, title); - mCurrentResultURLs.Put(url, PR_TRUE); + if (isMatch) { + nsAutoString image; + aPreviousResult->GetImageAt(i, image); + + mCurrentResultURLs.Put(url, PR_TRUE); - rv = mCurrentResult->AppendMatch(url, title, image, style); - NS_ENSURE_SUCCESS(rv, rv); + rv = mCurrentResult->AppendMatch(url, title, image, style); + NS_ENSURE_SUCCESS(rv, rv); + } } } }