Backout Bug 632835 in order to fix Bug 632835, a=backout
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Sat, 26 Feb 2011 18:30:57 +0200
changeset 63137 151d55505c10300e89e4cca795d79597e1705e0f
parent 63136 8996d8d193487f547dd87f2f82ff80b71bdd84fc
child 63138 e4b73866be7d4943dc2a53a8bbd6a4775445a4e2
push id19039
push useropettay@mozilla.com
push dateSat, 26 Feb 2011 16:36:00 +0000
treeherdermozilla-central@151d55505c10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs632835
milestone2.0b13pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout Bug 632835 in order to fix Bug 632835, a=backout
docshell/shistory/src/nsSHEntry.cpp
--- a/docshell/shistory/src/nsSHEntry.cpp
+++ b/docshell/shistory/src/nsSHEntry.cpp
@@ -640,17 +640,23 @@ nsSHEntry::AddChild(nsISHEntry * aChild,
       PRBool dyn = PR_FALSE;
       oldChild->IsDynamicallyAdded(&dyn);
       NS_WARN_IF_FALSE(dyn, "Adding child where we already have a child?  "
                             "This may misbehave");
     }
   }
 #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;
   }
 
   return NS_OK;
 }