Bug 1500138 - Remove browser.urlbar.matchBehavior and some unused Address Bar behaviors. r=adw

Remove browser.urlbar.matchBehavior pref. Remove code for BEGINNING behaviors, and stop referencing MATCH_BOUNDARY_ANYWHERE from our code.

Differential Revision: https://phabricator.services.mozilla.com/D9806
This commit is contained in:
Marco Bonardo
2018-10-25 23:23:36 +00:00
parent 28424af43d
commit ce7e8d741d
8 changed files with 120 additions and 228 deletions

View File

@@ -446,55 +446,6 @@ namespace places {
return findInString(aToken, aSourceString, eFindOnBoundary);
}
/* static */
bool
MatchAutoCompleteFunction::findBeginning(const nsDependentCSubstring &aToken,
const nsACString &aSourceString)
{
MOZ_ASSERT(!aToken.IsEmpty(), "Don't search for an empty token!");
// We can't use StringBeginsWith here, unfortunately. Although it will
// happily take a case-insensitive UTF8 comparator, it eventually calls
// nsACString::Equals, which checks that the two strings contain the same
// number of bytes before calling the comparator. Two characters may be
// case-insensitively equal while taking up different numbers of bytes, so
// this is not what we want.
const_char_iterator tokenStart(aToken.BeginReading()),
tokenEnd(aToken.EndReading()),
sourceStart(aSourceString.BeginReading()),
sourceEnd(aSourceString.EndReading());
bool dummy;
while (sourceStart < sourceEnd &&
CaseInsensitiveUTF8CharsEqual(sourceStart, tokenStart,
sourceEnd, tokenEnd,
&sourceStart, &tokenStart, &dummy)) {
// We found the token!
if (tokenStart >= tokenEnd) {
return true;
}
}
// We don't need to check CaseInsensitiveUTF8CharsEqual's error condition
// (stored in |dummy|), since the function will return false if it
// encounters an error.
return false;
}
/* static */
bool
MatchAutoCompleteFunction::findBeginningCaseSensitive(
const nsDependentCSubstring &aToken,
const nsACString &aSourceString)
{
MOZ_ASSERT(!aToken.IsEmpty(), "Don't search for an empty token!");
return StringBeginsWith(aSourceString, aToken);
}
/* static */
MatchAutoCompleteFunction::searchFunctionPtr
MatchAutoCompleteFunction::getSearchFunction(int32_t aBehavior)
@@ -503,10 +454,6 @@ namespace places {
case mozIPlacesAutoComplete::MATCH_ANYWHERE:
case mozIPlacesAutoComplete::MATCH_ANYWHERE_UNMODIFIED:
return findAnywhere;
case mozIPlacesAutoComplete::MATCH_BEGINNING:
return findBeginning;
case mozIPlacesAutoComplete::MATCH_BEGINNING_CASE_SENSITIVE:
return findBeginningCaseSensitive;
case mozIPlacesAutoComplete::MATCH_BOUNDARY:
default:
return findOnBoundary;