зеркало из https://github.com/mozilla/pjs.git
Bug 414257 - Stop searching for autocomplete results that won't be displayed. r=sspitzer, a1.9=beltzner
This commit is contained in:
Родитель
b69bafe1d2
Коммит
bf145b9c31
|
@ -112,6 +112,7 @@
|
|||
#define PREF_BROWSER_HISTORY_EXPIRE_SITES "history_expire_sites"
|
||||
#define PREF_AUTOCOMPLETE_ONLY_TYPED "urlbar.matchOnlyTyped"
|
||||
#define PREF_AUTOCOMPLETE_ENABLED "urlbar.autocomplete.enabled"
|
||||
#define PREF_AUTOCOMPLETE_MAX_RICH_RESULTS "urlbar.maxRichResults"
|
||||
#define PREF_DB_CACHE_PERCENTAGE "history_cache_percentage"
|
||||
#define PREF_FRECENCY_NUM_VISITS "places.frecency.numVisits"
|
||||
#define PREF_FRECENCY_UPDATE_IDLE_TIME "places.frecency.updateIdleTime"
|
||||
|
@ -309,6 +310,7 @@ nsNavHistory::nsNavHistory() : mNowValid(PR_FALSE),
|
|||
mExpireDaysMax(0),
|
||||
mExpireSites(0),
|
||||
mAutoCompleteOnlyTyped(PR_FALSE),
|
||||
mAutoCompleteMaxResults(25),
|
||||
mBatchLevel(0),
|
||||
mLock(nsnull),
|
||||
mBatchHasTransaction(PR_FALSE),
|
||||
|
@ -450,6 +452,7 @@ nsNavHistory::Init()
|
|||
nsCOMPtr<nsIPrefBranch2> pbi = do_QueryInterface(mPrefBranch);
|
||||
if (pbi) {
|
||||
pbi->AddObserver(PREF_AUTOCOMPLETE_ONLY_TYPED, this, PR_FALSE);
|
||||
pbi->AddObserver(PREF_AUTOCOMPLETE_MAX_RICH_RESULTS, this, PR_FALSE);
|
||||
pbi->AddObserver(PREF_BROWSER_HISTORY_EXPIRE_DAYS_MAX, this, PR_FALSE);
|
||||
pbi->AddObserver(PREF_BROWSER_HISTORY_EXPIRE_DAYS_MIN, this, PR_FALSE);
|
||||
pbi->AddObserver(PREF_BROWSER_HISTORY_EXPIRE_SITES, this, PR_FALSE);
|
||||
|
@ -1663,6 +1666,8 @@ nsNavHistory::LoadPrefs(PRBool aInitializing)
|
|||
PRBool oldCompleteOnlyTyped = mAutoCompleteOnlyTyped;
|
||||
mPrefBranch->GetBoolPref(PREF_AUTOCOMPLETE_ONLY_TYPED,
|
||||
&mAutoCompleteOnlyTyped);
|
||||
mPrefBranch->GetBoolPref(PREF_AUTOCOMPLETE_MAX_RICH_RESULTS,
|
||||
&mAutoCompleteMaxResults);
|
||||
if (!aInitializing && oldCompleteOnlyTyped != mAutoCompleteOnlyTyped) {
|
||||
// update the autocomplete statements if the option has changed.
|
||||
nsresult rv = CreateAutoCompleteQueries();
|
||||
|
|
|
@ -615,6 +615,7 @@ protected:
|
|||
nsresult InitAutoComplete();
|
||||
nsresult CreateAutoCompleteQueries();
|
||||
PRBool mAutoCompleteOnlyTyped;
|
||||
PRInt32 mAutoCompleteMaxResults;
|
||||
nsCOMPtr<nsITimer> mAutoCompleteTimer;
|
||||
|
||||
nsString mCurrentSearchString;
|
||||
|
|
|
@ -637,6 +637,11 @@ nsNavHistory::AutoCompleteFullHistorySearch(PRBool* aHasMoreResults)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mCurrentResultURLs.Put(entryURL, PR_TRUE);
|
||||
|
||||
if (mCurrentResultURLs.Count() >= mAutoCompleteMaxResults) {
|
||||
*aHasMoreResults = PR_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче