mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Bug 1166544 - Surroud FallibleTArray functions that are known to succeed with MOZ_ALWAYS_TRUE in dom/{smil,svg}/. r=dholbert
This commit is contained in:
parent
01b743a06b
commit
59360f960e
@ -784,22 +784,23 @@ nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// AppendElement() below must succeed, because SetCapacity() succeeded.
|
||||
if (!to.IsNull()) {
|
||||
if (!from.IsNull()) {
|
||||
result.AppendElement(from);
|
||||
result.AppendElement(to);
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(from));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to));
|
||||
} else {
|
||||
result.AppendElement(to);
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to));
|
||||
}
|
||||
} else if (!by.IsNull()) {
|
||||
nsSMILValue effectiveFrom(by.mType);
|
||||
if (!from.IsNull())
|
||||
effectiveFrom = from;
|
||||
// Set values to 'from; from + by'
|
||||
result.AppendElement(effectiveFrom);
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom));
|
||||
nsSMILValue effectiveTo(effectiveFrom);
|
||||
if (!effectiveTo.IsNull() && NS_SUCCEEDED(effectiveTo.Add(by))) {
|
||||
result.AppendElement(effectiveTo);
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo));
|
||||
} else {
|
||||
// Using by-animation with non-additive type or bad base-value
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -266,7 +266,7 @@ DOMSVGLengthList::InsertItemBefore(DOMSVGLength& newItem,
|
||||
MaybeInsertNullInAnimValListAt(index);
|
||||
|
||||
InternalList().InsertItem(index, domItem->ToSVGLength());
|
||||
mItems.InsertElementAt(index, domItem.get());
|
||||
MOZ_ALWAYS_TRUE(mItems.InsertElementAt(index, domItem.get()));
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
|
@ -250,7 +250,7 @@ DOMSVGNumberList::InsertItemBefore(DOMSVGNumber& aItem,
|
||||
MaybeInsertNullInAnimValListAt(index);
|
||||
|
||||
InternalList().InsertItem(index, domItem->ToSVGNumber());
|
||||
mItems.InsertElementAt(index, domItem);
|
||||
MOZ_ALWAYS_TRUE(mItems.InsertElementAt(index, domItem));
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
|
@ -384,8 +384,12 @@ DOMSVGPathSegList::InsertItemBefore(DOMSVGPathSeg& aNewItem,
|
||||
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
|
||||
domItem->ToSVGPathSegEncodedData(segAsRaw);
|
||||
|
||||
InternalList().mData.InsertElementsAt(internalIndex, segAsRaw, 1 + argCount);
|
||||
mItems.InsertElementAt(aIndex, ItemProxy(domItem.get(), internalIndex));
|
||||
MOZ_ALWAYS_TRUE(InternalList().mData.InsertElementsAt(internalIndex,
|
||||
segAsRaw,
|
||||
1 + argCount));
|
||||
MOZ_ALWAYS_TRUE(mItems.InsertElementAt(aIndex,
|
||||
ItemProxy(domItem.get(),
|
||||
internalIndex)));
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
|
@ -317,7 +317,7 @@ DOMSVGPointList::InsertItemBefore(nsISVGPoint& aNewItem, uint32_t aIndex,
|
||||
MaybeInsertNullInAnimValListAt(aIndex);
|
||||
|
||||
InternalList().InsertItem(aIndex, domItem->ToSVGPoint());
|
||||
mItems.InsertElementAt(aIndex, domItem);
|
||||
MOZ_ALWAYS_TRUE(mItems.InsertElementAt(aIndex, domItem));
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
|
@ -258,7 +258,7 @@ DOMSVGTransformList::InsertItemBefore(SVGTransform& newItem,
|
||||
MaybeInsertNullInAnimValListAt(index);
|
||||
|
||||
InternalList().InsertItem(index, domItem->ToSVGTransform());
|
||||
mItems.InsertElementAt(index, domItem.get());
|
||||
MOZ_ALWAYS_TRUE(mItems.InsertElementAt(index, domItem.get()));
|
||||
|
||||
// This MUST come after the insertion into InternalList(), or else under the
|
||||
// insertion into InternalList() the values read from domItem would be bad
|
||||
|
@ -441,8 +441,9 @@ SVGMotionSMILType::Interpolate(const nsSMILValue& aStartVal,
|
||||
|
||||
// Construct the intermediate result segment, and put it in our outparam.
|
||||
// AppendElement has guaranteed success here, since Init() allocates 1 slot.
|
||||
resultArr.AppendElement(MotionSegment(path, resultDist,
|
||||
rotateType, rotateAngle));
|
||||
MOZ_ALWAYS_TRUE(resultArr.AppendElement(MotionSegment(path, resultDist,
|
||||
rotateType,
|
||||
rotateAngle)));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -484,7 +485,8 @@ SVGMotionSMILType::ConstructSMILValue(Path* aPath,
|
||||
MotionSegmentArray& arr = ExtractMotionSegmentArray(smilVal);
|
||||
|
||||
// AppendElement has guaranteed success here, since Init() allocates 1 slot.
|
||||
arr.AppendElement(MotionSegment(aPath, aDist, aRotateType, aRotateAngle));
|
||||
MOZ_ALWAYS_TRUE(arr.AppendElement(MotionSegment(aPath, aDist,
|
||||
aRotateType, aRotateAngle)));
|
||||
return smilVal;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList,
|
||||
for (uint32_t i = 0; i < aList.Length(); ++i) {
|
||||
// No need to check the return value below since we have already allocated
|
||||
// the necessary space
|
||||
transforms.AppendElement(SVGTransformSMILData(aList[i]));
|
||||
MOZ_ALWAYS_TRUE(transforms.AppendElement(SVGTransformSMILData(aList[i])));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user