From 89c81d0188b6426909cb1f2f00125443753bfaf0 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Thu, 18 Nov 2010 16:09:30 -0800 Subject: [PATCH] Bug 594223 - Don't call searchFunction unnecessarily in MatchAutoCompleteFunction::OnFunctionCall. r,a=sdwilsh --- .../components/places/src/SQLFunctions.cpp | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/toolkit/components/places/src/SQLFunctions.cpp b/toolkit/components/places/src/SQLFunctions.cpp index dae2104faf8..ef64f1437c5 100644 --- a/toolkit/components/places/src/SQLFunctions.cpp +++ b/toolkit/components/places/src/SQLFunctions.cpp @@ -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));