Bug 255593 Add ReplaceElementAt to nsIMutableArray plus comment fixes p=eyalroz@technion.ac.il r=darin sr=bienvenu
git-svn-id: svn://10.0.0.236/trunk@167166 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -153,6 +153,24 @@ nsArray::InsertElementAt(nsISupports* aElement, PRUint32 aIndex, PRBool aWeak)
|
||||
return result ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsArray::ReplaceElementAt(nsISupports* aElement, PRUint32 aIndex, PRBool aWeak)
|
||||
{
|
||||
nsCOMPtr<nsISupports> elementRef;
|
||||
if (aWeak) {
|
||||
elementRef =
|
||||
getter_AddRefs(NS_STATIC_CAST(nsISupports*,
|
||||
NS_GetWeakReference(aElement)));
|
||||
NS_ASSERTION(elementRef, "ReplaceElementAt: Trying to use weak references on an object that doesn't support it");
|
||||
if (!elementRef)
|
||||
return NS_ERROR_FAILURE;
|
||||
} else {
|
||||
elementRef = aElement;
|
||||
}
|
||||
PRBool result = mArray.ReplaceObjectAt(elementRef, aIndex);
|
||||
return result ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsArray::Clear()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user