Fixing bug #25359, accessing mimetypes by name wasn't implemented, now it is. r=av@netscape.com

This commit is contained in:
jst%netscape.com 2000-04-18 22:08:05 +00:00
parent 0c9cf5e111
commit bf6e7d26cc

View File

@ -120,10 +120,36 @@ NS_IMETHODIMP MimeTypeArrayImpl::Item(PRUint32 aIndex, nsIDOMMimeType** aReturn)
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP MimeTypeArrayImpl::NamedItem(const nsString& aName, nsIDOMMimeType** aReturn)
NS_IMETHODIMP MimeTypeArrayImpl::NamedItem(const nsString& aName,
nsIDOMMimeType** aReturn)
{
*aReturn = nsnull;
return NS_OK;
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = nsnull;
if (mMimeTypeArray == nsnull) {
nsresult rv = GetMimeTypes();
if (rv != NS_OK)
return rv;
}
PRUint32 i;
for (i = 0; i < mMimeTypeCount; i++) {
nsIDOMMimeType *mtype = mMimeTypeArray[i];
nsAutoString type;
mtype->GetType(type);
if (type.Equals(aName)) {
*aReturn = mtype;
NS_ADDREF(*aReturn);
break;
}
}
return NS_OK;
}
nsresult MimeTypeArrayImpl::GetMimeTypes()