зеркало из https://github.com/mozilla/gecko-dev.git
Bug 225507: Implement nsCOMArray::SafeObjectAt for out-of-bounds safe access.
r=bryner sr=alecf
This commit is contained in:
Родитель
f777369283
Коммит
932310909a
|
@ -100,6 +100,10 @@ public:
|
|||
return NS_STATIC_CAST(nsISupports*, mArray.ElementAt(aIndex));
|
||||
}
|
||||
|
||||
nsISupports* SafeObjectAt(PRInt32 aIndex) const {
|
||||
return NS_STATIC_CAST(nsISupports*, mArray.SafeElementAt(aIndex));
|
||||
}
|
||||
|
||||
nsISupports* operator[](PRInt32 aIndex) const {
|
||||
return ObjectAt(aIndex);
|
||||
}
|
||||
|
@ -149,6 +153,11 @@ class nsCOMArray : public nsCOMArray_base
|
|||
return NS_STATIC_CAST(T*,nsCOMArray_base::ObjectAt(aIndex));
|
||||
}
|
||||
|
||||
// these do NOT refcount on the way out, for speed
|
||||
T* SafeObjectAt(PRInt32 aIndex) const {
|
||||
return NS_STATIC_CAST(T*,nsCOMArray_base::SafeObjectAt(aIndex));
|
||||
}
|
||||
|
||||
// indexing operator for syntactic sugar
|
||||
T* operator[](PRInt32 aIndex) const {
|
||||
return ObjectAt(aIndex);
|
||||
|
|
Загрузка…
Ссылка в новой задаче