Patch GetMethodInfoForName to not just return the first method found. Apparently, it never really worked.

Thanks to Mark G. Adams <madams@janna.com> for the patch.

r=mccabe
a=bruce (deputized)
This commit is contained in:
mccabe%netscape.com 2000-05-18 05:55:25 +00:00
Родитель cb005dd346
Коммит 7958962de4
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -318,23 +318,29 @@ xptiInterfaceInfo::GetMethodInfoForName(const char* methodName, uint16 *index,
return NS_ERROR_UNEXPECTED;
// This is a slow algorithm, but this is not expected to be called much.
for(uint16 i = mInterface->mMethodBaseIndex;
i < mInterface->mDescriptor->num_methods;
for(uint16 i = 0;
i < mInterface->mDescriptor->num_methods;
++i)
{
const nsXPTMethodInfo* info;
info = NS_REINTERPRET_CAST(nsXPTMethodInfo*,
&mInterface->mDescriptor->
method_descriptors[i -
mInterface->mMethodBaseIndex]);
*index = i;
*result = info;
return NS_OK;
method_descriptors[i]);
if (PL_strcmp(methodName, info->GetName()) == 0) {
*index = i + mInterface->mMethodBaseIndex;
*result = info;
return NS_OK;
}
}
if(mInterface->mParent)
return mInterface->mParent->GetMethodInfoForName(methodName, index, result);
return mInterface->mParent->GetMethodInfoForName(methodName,
index, result);
else
{
*index = 0;
*result = 0;
return NS_ERROR_INVALID_ARG;
}
}
NS_IMETHODIMP