From 5170d49ed9c099bbfa6939332fa44af37f02b509 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Sat, 26 Feb 2011 18:30:57 +0200 Subject: [PATCH] Backout Bug 632835 in order to fix Bug 632835, a=backout --- docshell/shistory/src/nsSHEntry.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docshell/shistory/src/nsSHEntry.cpp b/docshell/shistory/src/nsSHEntry.cpp index 2ab42a00397..a0eee6fda25 100644 --- a/docshell/shistory/src/nsSHEntry.cpp +++ b/docshell/shistory/src/nsSHEntry.cpp @@ -645,7 +645,13 @@ nsSHEntry::AddChild(nsISHEntry * aChild, PRInt32 aOffset) } #endif - if (!mChildren.ReplaceObjectAt(aChild, aOffset)) { + // InsertObjectAt allows only appending one object. + // If aOffset is larger than Count(), we must first manually + // set the capacity. + if (aOffset > mChildren.Count()) { + mChildren.SetCount(aOffset); + } + if (!mChildren.InsertObjectAt(aChild, aOffset)) { NS_WARNING("Adding a child failed!"); aChild->SetParent(nsnull); return NS_ERROR_FAILURE;