Bug 906150 - initialize an empty RangeData at each point of use in nsSelection.cpp; r=smaug

This commit is contained in:
Nathan Froyd 2013-08-16 15:01:04 -04:00
parent 48f413a43c
commit a928ea6f0d

View File

@ -129,8 +129,6 @@ struct CachedOffsetForFrame {
bool mCanCacheFrameOffset; // cached frame offset is valid?
};
static RangeData sEmptyData(nullptr);
// Stack-class to turn on/off selection batching for table selection
class MOZ_STACK_CLASS nsSelectionBatcher MOZ_FINAL
{
@ -4525,7 +4523,8 @@ Selection::GetRangeCount(int32_t* aRangeCount)
NS_IMETHODIMP
Selection::GetRangeAt(int32_t aIndex, nsIDOMRange** aReturn)
{
*aReturn = mRanges.SafeElementAt(aIndex, sEmptyData).mRange;
RangeData empty(nullptr);
*aReturn = mRanges.SafeElementAt(aIndex, empty).mRange;
if (!*aReturn) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
@ -4538,7 +4537,8 @@ Selection::GetRangeAt(int32_t aIndex, nsIDOMRange** aReturn)
nsRange*
Selection::GetRangeAt(int32_t aIndex)
{
return mRanges.SafeElementAt(aIndex, sEmptyData).mRange;
RangeData empty(nullptr);
return mRanges.SafeElementAt(aIndex, empty).mRange;
}
/*