Bug 853567 - Fix nsTArray::SetCapacity callers in nsContentIterator to not look at the return value; r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 21 Mar 2013 14:52:48 -0400
changeset 125829 89f1f298226ef8552156b902fdda4da478f21e27
parent 125828 eda31d5153fd0c905ccba3e372ed6ade6d20f197
child 125830 fa5fce9ac1e3e7b5646a60a53eaa0e5ad7d3327b
push id25111
push usereakhgari@mozilla.com
push dateThu, 21 Mar 2013 20:06:25 +0000
treeherdermozilla-inbound@b06530d4fb32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs853567
milestone22.0a1
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
Bug 853567 - Fix nsTArray::SetCapacity callers in nsContentIterator to not look at the return value; r=bzbarsky
content/base/src/nsContentIterator.cpp
--- a/content/base/src/nsContentIterator.cpp
+++ b/content/base/src/nsContentIterator.cpp
@@ -987,19 +987,17 @@ nsContentIterator::PositionAt(nsINode* a
 
   // Get a list of the parents up to the root, then compare the new node with
   // entries in that array until we find a match (lowest common ancestor).  If
   // no match, use IndexOf, take the parent, and repeat.  This avoids using
   // IndexOf() N times on possibly large arrays.  We still end up doing it a
   // fair bit.  It's better to use Clone() if possible.
 
   // we know the depth we're down (though we may not have started at the top).
-  if (!oldParentStack.SetCapacity(mIndexes.Length() + 1)) {
-    return NS_ERROR_FAILURE;
-  }
+  oldParentStack.SetCapacity(mIndexes.Length() + 1);
 
   // We want to loop mIndexes.Length() + 1 times here, because we want to make
   // sure we include mCommonParent in the oldParentStack, for use in the next
   // for loop, and mIndexes only has entries for nodes from tempNode up through
   // an ancestor of tempNode that's a child of mCommonParent.
   for (int32_t i = mIndexes.Length() + 1; i > 0 && tempNode; i--) {
     // Insert at head since we're walking up
     oldParentStack.InsertElementAt(0, tempNode);