Bug 1475282: Fix DEAD_STORE issues in ProfileReset. r?erahm draft
authorRobert Bartlensky <rbartlensky@mozilla.com>
Mon, 16 Jul 2018 18:27:16 +0100
changeset 819218 fcec853a82ef
parent 819215 547144f5596c
push id116456
push userbmo:rbartlensky@mozilla.com
push dateTue, 17 Jul 2018 10:13:20 +0000
reviewerserahm
bugs1475282
milestone63.0a1
Bug 1475282: Fix DEAD_STORE issues in ProfileReset. r?erahm MozReview-Commit-ID: 45COqLBdEze
toolkit/xre/ProfileReset.cpp
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -16,16 +16,17 @@
 #include "nsPIDOMWindow.h"
 #include "nsPrintfCString.h"
 #include "nsString.h"
 #include "nsToolkitCompsCID.h"
 #include "nsXPCOMCIDInternal.h"
 #include "mozilla/XREAppData.h"
 
 #include "mozilla/Services.h"
+#include "mozilla/Unused.h"
 #include "prtime.h"
 
 using namespace mozilla;
 
 extern const XREAppData* gAppData;
 
 static const char kProfileProperties[] =
   "chrome://mozapps/locale/profile/profileSelection.properties";
@@ -76,27 +77,28 @@ ProfileResetCleanup(nsIToolkitProfile* a
   rv = aOldProfile->GetLocalDir(getter_AddRefs(profileLocalDir));
   if (NS_FAILED(rv)) return rv;
 
   // Get the friendly name for the backup directory.
   nsCOMPtr<nsIStringBundleService> sbs = mozilla::services::GetStringBundleService();
   if (!sbs) return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIStringBundle> sb;
-  rv = sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
+  Unused << sbs->CreateBundle(kProfileProperties, getter_AddRefs(sb));
   if (!sb) return NS_ERROR_FAILURE;
 
   NS_ConvertUTF8toUTF16 appName(gAppData->name);
   const char16_t* params[] = {appName.get(), appName.get()};
 
   nsAutoString resetBackupDirectoryName;
 
   static const char* kResetBackupDirectory = "resetBackupDirectory";
   rv = sb->FormatStringFromName(kResetBackupDirectory, params, 2,
                                 resetBackupDirectoryName);
+  if (NS_FAILED(rv)) return rv;
 
   // Get info to copy the old root profile dir to the desktop as a backup.
   nsCOMPtr<nsIFile> backupDest, containerDest, profileDest;
   rv = NS_GetSpecialDirectory(NS_OS_DESKTOP_DIR, getter_AddRefs(backupDest));
   if (NS_FAILED(rv)) {
     // Fall back to the home directory if the desktop is not available.
     rv = NS_GetSpecialDirectory(NS_OS_HOME_DIR, getter_AddRefs(backupDest));
     if (NS_FAILED(rv)) return rv;