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));