зеркало из https://github.com/mozilla/pjs.git
Bug 594223 - Don't call searchFunction unnecessarily in MatchAutoCompleteFunction::OnFunctionCall. r,a=sdwilsh
This commit is contained in:
Родитель
48f6c5b87f
Коммит
967c8c31e3
|
@ -395,21 +395,21 @@ namespace places {
|
|||
while (matches && tokenizer.hasMoreTokens()) {
|
||||
const nsDependentCSubstring &token = tokenizer.nextToken();
|
||||
|
||||
bool matchTags = searchFunction(token, tags);
|
||||
bool matchTitle = searchFunction(token, title);
|
||||
|
||||
// Make sure we match something in the title or tags if we have to.
|
||||
matches = matchTags || matchTitle;
|
||||
if (HAS_BEHAVIOR(TITLE) && !matches)
|
||||
break;
|
||||
|
||||
bool matchURL = searchFunction(token, fixedURI);
|
||||
// If we do not match the URL when we have to, reset matches to false.
|
||||
// Otherwise, keep track that we did match the current search.
|
||||
if (HAS_BEHAVIOR(URL) && !matchURL)
|
||||
matches = false;
|
||||
else
|
||||
matches = matches || matchURL;
|
||||
if (HAS_BEHAVIOR(TITLE) && HAS_BEHAVIOR(URL)) {
|
||||
matches = (searchFunction(token, title) || searchFunction(token, tags)) &&
|
||||
searchFunction(token, fixedURI);
|
||||
}
|
||||
else if (HAS_BEHAVIOR(TITLE)) {
|
||||
matches = searchFunction(token, title) || searchFunction(token, tags);
|
||||
}
|
||||
else if (HAS_BEHAVIOR(URL)) {
|
||||
matches = searchFunction(token, fixedURI);
|
||||
}
|
||||
else {
|
||||
matches = searchFunction(token, title) ||
|
||||
searchFunction(token, tags) ||
|
||||
searchFunction(token, fixedURI);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*_result = new IntegerVariant(matches ? 1 : 0));
|
||||
|
|
Загрузка…
Ссылка в новой задаче