bug 1203861 - use strncmp() instead of nsCString.equals() to compare names r=davidb

AtkObject stores the name as a C string, but nsCString can store strings with
'\0' in the middle.  That means that if we compute a name containing '\0'
nsCString.equals() will nevr consider that string to be equal to
AtkObject::name, however we only want to compare up to the first '\0' because
that is the only part Atk will ever see.  So we should use strncmp() instead of
nsCString.equals().
This commit is contained in:
Trevor Saunders 2016-01-06 18:00:06 -05:00
parent cd34e20d78
commit 5c8b5951d4

View File

@ -597,7 +597,8 @@ static void
MaybeFireNameChange(AtkObject* aAtkObj, const nsString& aNewName)
{
NS_ConvertUTF16toUTF8 newNameUTF8(aNewName);
if (aAtkObj->name && newNameUTF8.Equals(aAtkObj->name))
if (aAtkObj->name &&
!strncmp(aAtkObj->name, newNameUTF8.get(), newNameUTF8.Length()))
return;
// Below we duplicate the functionality of atk_object_set_name(),