зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1166805 part 2 - Call SetCapacity before calling DOMSVGXXXList::MaybeInsertNullInAnimValListAt, to prevent fallible InsertElementAt calls from failing r=dholbert
This commit is contained in:
Родитель
e12ab5ca8b
Коммит
4b121e2bff
|
@ -260,6 +260,13 @@ DOMSVGLengthList::InsertItemBefore(DOMSVGLength& newItem,
|
|||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
if (AnimListMirrorsBaseList()) {
|
||||
if (!mAList->mAnimVal->mItems.SetCapacity(
|
||||
mAList->mAnimVal->mItems.Length() + 1, fallible)) {
|
||||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AutoChangeLengthListNotifier notifier(this);
|
||||
// Now that we know we're inserting, keep animVal list in sync as necessary.
|
||||
|
|
|
@ -244,6 +244,13 @@ DOMSVGNumberList::InsertItemBefore(DOMSVGNumber& aItem,
|
|||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
if (AnimListMirrorsBaseList()) {
|
||||
if (!mAList->mAnimVal->mItems.SetCapacity(
|
||||
mAList->mAnimVal->mItems.Length() + 1, fallible)) {
|
||||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AutoChangeNumberListNotifier notifier(this);
|
||||
// Now that we know we're inserting, keep animVal list in sync as necessary.
|
||||
|
|
|
@ -382,6 +382,15 @@ DOMSVGPathSegList::InsertItemBefore(DOMSVGPathSeg& aNewItem,
|
|||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
if (AnimListMirrorsBaseList()) {
|
||||
DOMSVGPathSegList *animVal =
|
||||
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
|
||||
if (!animVal->mItems.SetCapacity(
|
||||
animVal->mItems.Length() + 1, fallible)) {
|
||||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AutoChangePathSegListNotifier notifier(this);
|
||||
// Now that we know we're inserting, keep animVal list in sync as necessary.
|
||||
|
|
|
@ -318,6 +318,15 @@ DOMSVGPointList::InsertItemBefore(nsISVGPoint& aNewItem, uint32_t aIndex,
|
|||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
if (AnimListMirrorsBaseList()) {
|
||||
DOMSVGPointList *animVal =
|
||||
GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
|
||||
if (!animVal->mItems.SetCapacity(
|
||||
animVal->mItems.Length() + 1, fallible)) {
|
||||
aError.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AutoChangePointListNotifier notifier(this);
|
||||
// Now that we know we're inserting, keep animVal list in sync as necessary.
|
||||
|
|
|
@ -252,6 +252,13 @@ DOMSVGTransformList::InsertItemBefore(SVGTransform& newItem,
|
|||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
if (AnimListMirrorsBaseList()) {
|
||||
if (!mAList->mAnimVal->mItems.SetCapacity(
|
||||
mAList->mAnimVal->mItems.Length() + 1, fallible)) {
|
||||
error.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AutoChangeTransformListNotifier notifier(this);
|
||||
// Now that we know we're inserting, keep animVal list in sync as necessary.
|
||||
|
|
Загрузка…
Ссылка в новой задаче