Fix bug 262056, "username in password manager case sensitive". r=bryner.

git-svn-id: svn://10.0.0.236/trunk@191012 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jruderman%hmc.edu 2006-02-23 09:33:46 +00:00
parent 5eea6eae6d
commit d41b46b313
2 changed files with 4 additions and 2 deletions

View File

@ -62,6 +62,7 @@ REQUIRES = \
widget \ widget \
autocomplete \ autocomplete \
pipnss \ pipnss \
unicharutil \
$(NULL) $(NULL)
XPIDLSRCS = \ XPIDLSRCS = \

View File

@ -70,6 +70,7 @@
#include "nsIAutoCompleteResult.h" #include "nsIAutoCompleteResult.h"
#include "nsIPK11TokenDB.h" #include "nsIPK11TokenDB.h"
#include "nsIPK11Token.h" #include "nsIPK11Token.h"
#include "nsUnicharUtils.h"
static const char kPMPropertiesURL[] = "chrome://passwordmgr/locale/passwordmgr.properties"; static const char kPMPropertiesURL[] = "chrome://passwordmgr/locale/passwordmgr.properties";
static PRBool sRememberPasswords = PR_FALSE; static PRBool sRememberPasswords = PR_FALSE;
@ -1502,7 +1503,7 @@ nsPasswordManager::AutoCompleteSearch(const nsAString& aSearchString,
for (PRInt32 i = result->mArray.Count() - 1; i >= 0; --i) { for (PRInt32 i = result->mArray.Count() - 1; i >= 0; --i) {
nsDependentString match(NS_STATIC_CAST(PRUnichar*, result->mArray.ElementAt(i))); nsDependentString match(NS_STATIC_CAST(PRUnichar*, result->mArray.ElementAt(i)));
if (aSearchString.Length() > match.Length() || if (aSearchString.Length() > match.Length() ||
!StringBeginsWith(match, aSearchString)) { !StringBeginsWith(match, aSearchString, nsCaseInsensitiveStringComparator())) {
nsMemory::Free(result->mArray.ElementAt(i)); nsMemory::Free(result->mArray.ElementAt(i));
result->mArray.RemoveElementAt(i); result->mArray.RemoveElementAt(i);
} }
@ -1541,7 +1542,7 @@ nsPasswordManager::AutoCompleteSearch(const nsAString& aSearchString,
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
if (aSearchString.Length() <= userValue.Length() && if (aSearchString.Length() <= userValue.Length() &&
StringBeginsWith(userValue, aSearchString)) { StringBeginsWith(userValue, aSearchString, nsCaseInsensitiveStringComparator())) {
PRUnichar* data = ToNewUnicode(userValue); PRUnichar* data = ToNewUnicode(userValue);
if (data) if (data)
result->mArray.AppendElement(data); result->mArray.AppendElement(data);