Bug 1455707: Remove CanShowProfileManager(). r=froydnj draft
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 15 May 2018 10:43:55 -0700
changeset 799556 4777e0648f1767d6b3c89a7982bad9c531d7d176
parent 799392 ff8505d177b9fcba44b040ccd9b6bb709e238e84
child 799557 e5c020748f4bf9316c120f5e9b640788abc45b30
child 802437 95ccfef1c70d169dd19035ef25255dcb5553e985
push id111106
push userdtownsend@mozilla.com
push dateThu, 24 May 2018 22:39:40 +0000
reviewersfroydnj
bugs1455707
milestone62.0a1
Bug 1455707: Remove CanShowProfileManager(). r=froydnj MozReview-Commit-ID: IXDSW8suEBd
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -549,27 +549,16 @@ ProcessDDE(nsINativeAppSupport* aNative,
       // If count is 8 or less windows will display an error dialog.
       int32_t count = 20;
       SpinEventLoopUntil([&]() { return --count < 0; });
     }
   }
 }
 #endif
 
-/**
- * Determines if there is support for showing the profile manager
- *
- * @return true in all environments
-*/
-static bool
-CanShowProfileManager()
-{
-  return true;
-}
-
 bool gSafeMode = false;
 
 /**
  * The nsXULAppInfo object implements nsIFactory so that it can be its own
  * singleton.
  */
 class nsXULAppInfo : public nsIXULAppInfo,
                      public nsIObserver,
@@ -2079,20 +2068,16 @@ ProfileLockedDialog(nsIToolkitProfile* a
 
 static const char kProfileManagerURL[] =
   "chrome://mozapps/content/profile/profileSelection.xul";
 
 static ReturnAbortOnError
 ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
                    nsINativeAppSupport* aNative)
 {
-  if (!CanShowProfileManager()) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
   nsresult rv;
 
   nsCOMPtr<nsIFile> profD, profLD;
   char16_t* profileNamePtr;
   nsAutoCString profileName;
 
   {
     ScopedXPCOMStartup xpcom;
@@ -2423,19 +2408,17 @@ SelectProfile(nsIProfileLock* *aResult, 
   ar = CheckArg("p", &arg);
   if (ar == ARG_BAD) {
     ar = CheckArg("osint");
     if (ar == ARG_FOUND) {
       PR_fprintf(PR_STDERR, "Error: argument -p is invalid when argument --osint is specified\n");
       return NS_ERROR_FAILURE;
     }
 
-    if (CanShowProfileManager()) {
-      return ShowProfileManager(aProfileSvc, aNative);
-    }
+    return ShowProfileManager(aProfileSvc, aNative);
   }
   if (ar) {
     ar = CheckArg("osint");
     if (ar == ARG_FOUND) {
       PR_fprintf(PR_STDERR, "Error: argument -p is invalid when argument --osint is specified\n");
       return NS_ERROR_FAILURE;
     }
     nsCOMPtr<nsIToolkitProfile> profile;
@@ -2475,27 +2458,25 @@ SelectProfile(nsIProfileLock* *aResult, 
         if (aProfileName)
           aProfileName->Assign(nsDependentCString(arg));
         return NS_OK;
       }
 
       return ProfileLockedDialog(profile, unlocker, aNative, aResult);
     }
 
-    if (CanShowProfileManager()) {
-      return ShowProfileManager(aProfileSvc, aNative);
-    }
+    return ShowProfileManager(aProfileSvc, aNative);
   }
 
   ar = CheckArg("profilemanager", nullptr, CheckArgFlag::CheckOSInt | CheckArgFlag::RemoveArg);
   if (ar == ARG_BAD) {
     PR_fprintf(PR_STDERR, "Error: argument --profilemanager is invalid when argument --osint is specified\n");
     return NS_ERROR_FAILURE;
   }
-  if (ar == ARG_FOUND && CanShowProfileManager()) {
+  if (ar == ARG_FOUND) {
     return ShowProfileManager(aProfileSvc, aNative);
   }
 
 #ifndef MOZ_DEV_EDITION
   // If the only existing profile is the dev-edition-profile and this is not
   // Developer Edition, then no valid profiles were found.
   if (count == 1) {
     nsCOMPtr<nsIToolkitProfile> deProfile;
@@ -2538,17 +2519,17 @@ SelectProfile(nsIProfileLock* *aResult, 
           aProfileName->AssignLiteral("default");
 #endif
         return NS_OK;
       }
     }
   }
 
   bool useDefault = true;
-  if (count > 1 && CanShowProfileManager()) {
+  if (count > 1) {
     aProfileSvc->GetStartWithLastProfile(&useDefault);
   }
 
   if (useDefault) {
     nsCOMPtr<nsIToolkitProfile> profile;
     // GetSelectedProfile will auto-select the only profile if there's just one
     aProfileSvc->GetSelectedProfile(getter_AddRefs(profile));
     if (profile) {
@@ -2606,20 +2587,16 @@ SelectProfile(nsIProfileLock* *aResult, 
         }
         PR_Sleep(kLockRetrySleepMS);
       } while (TimeStamp::Now() - start < TimeDuration::FromSeconds(kLockRetrySeconds));
 
       return ProfileLockedDialog(profile, unlocker, aNative, aResult);
     }
   }
 
-  if (!CanShowProfileManager()) {
-    return NS_ERROR_FAILURE;
-  }
-
   return ShowProfileManager(aProfileSvc, aNative);
 }
 
 /**
  * Checks the compatibility.ini file to see if we have updated our application
  * or otherwise invalidated our caches. If the application has been updated,
  * we return false; otherwise, we return true. We also write the status
  * of the caches (valid/invalid) into the return param aCachesOK. The aCachesOK