Bug 1188180 - Fix possible uninitialized variable use; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Wed, 05 Aug 2015 15:28:28 +0300
changeset 287955 352601bcc3070923eb908b5678613a4fcfcecdd9
parent 287954 ac4ab76805209c35c32ae8e88aebbb163b0454ae
child 287956 7b8dc7443e3a970fed752690b5e972ce79129a31
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1188180
milestone42.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 1188180 - Fix possible uninitialized variable use; r=ehsan
editor/libeditor/nsHTMLEditRules.cpp
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -5757,17 +5757,17 @@ nsHTMLEditRules::GetNodesForOperation(ns
                                       nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
                                       EditAction aOperationType,
                                       TouchContent aTouchContent)
 {
   NS_ENSURE_STATE(mHTMLEditor);
   nsCOMPtr<nsIEditor> kungFuDeathGrip(mHTMLEditor);
 
   int32_t rangeCount = aArrayOfRanges.Length();
-  nsresult res;
+  nsresult res = NS_OK;
 
   // Bust up any inlines that cross our range endpoints, but only if we are
   // allowed to touch content.
 
   if (aTouchContent == TouchContent::yes) {
     nsTArray<OwningNonNull<nsRangeStore>> rangeItemArray;
     rangeItemArray.AppendElements(rangeCount);
 
@@ -5790,17 +5790,17 @@ nsHTMLEditRules::GetNodesForOperation(ns
       mHTMLEditor->mRangeUpdater.DropRangeItem(item);
       aArrayOfRanges.AppendElement(item->GetRange());
     }
     NS_ENSURE_SUCCESS(res, res);
   }
   // Gather up a list of all the nodes
   for (auto& range : aArrayOfRanges) {
     nsDOMSubtreeIterator iter;
-    nsresult res = iter.Init(*range);
+    res = iter.Init(*range);
     NS_ENSURE_SUCCESS(res, res);
     if (aOutArrayOfNodes.Length() == 0) {
       iter.AppendList(nsTrivialFunctor(), aOutArrayOfNodes);
     } else {
       // We don't want duplicates in aOutArrayOfNodes, so we use an
       // iterator/functor that only return nodes that are not already in
       // aOutArrayOfNodes.
       nsTArray<OwningNonNull<nsINode>> nodes;