Bug 1527499: Show the profile manager by default in preference to assigning or creating an initial profile. r=froydnj
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 13 Feb 2019 14:04:23 +0000
changeset 458923 f6c24d795990
parent 458922 b09a49ab3635
child 458924 8df956c34c94
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1527499
milestone67.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 1527499: Show the profile manager by default in preference to assigning or creating an initial profile. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D19592
toolkit/profile/nsToolkitProfileService.cpp
toolkit/profile/xpcshell/test_startswithlast.js
toolkit/profile/xpcshell/xpcshell.ini
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -1017,16 +1017,21 @@ nsresult nsToolkitProfileService::Select
                "Error: argument --profilemanager is invalid when argument "
                "--osint is specified\n");
     return NS_ERROR_FAILURE;
   }
   if (ar == ARG_FOUND) {
     return NS_ERROR_SHOW_PROFILE_MANAGER;
   }
 
+  // We've been told not to use the selected profile automatically.
+  if (!mStartWithLast) {
+    return NS_ERROR_SHOW_PROFILE_MANAGER;
+  }
+
   // If this is a first run then create a new profile.
   if (mIsFirstRun) {
     if (aIsResetting) {
       // We don't want to create a fresh profile when we're attempting a
       // profile reset so just bail out here, the calling code will handle it.
       *aProfile = nullptr;
       return NS_OK;
     }
@@ -1119,21 +1124,16 @@ nsresult nsToolkitProfileService::Select
       mCurrent->GetLocalDir(aLocalDir);
       NS_ADDREF(*aProfile = mCurrent);
 
       *aDidCreate = true;
       return NS_OK;
     }
   }
 
-  // We've been told not to use the selected profile automatically.
-  if (!mStartWithLast) {
-    return NS_ERROR_SHOW_PROFILE_MANAGER;
-  }
-
   GetDefaultProfile(getter_AddRefs(mCurrent));
 
   // None of the profiles was marked as default (generally only happens if the
   // user modifies profiles.ini manually). Let the user choose.
   if (!mCurrent) {
     return NS_ERROR_SHOW_PROFILE_MANAGER;
   }
 
new file mode 100644
--- /dev/null
+++ b/toolkit/profile/xpcshell/test_startswithlast.js
@@ -0,0 +1,23 @@
+/*
+ * Tests that if profiles.ini is set to not start with the last profile then
+ * we show the profile manager in preference to assigning the old default.
+ */
+
+add_task(async () => {
+  let defaultProfile = makeRandomProfileDir("default");
+
+  writeCompatibilityIni(defaultProfile);
+
+  writeProfilesIni({
+    options: {
+      startWithLastProfile: false,
+    },
+    profiles: [{
+      name: PROFILE_DEFAULT,
+      path: defaultProfile.leafName,
+      default: true,
+    }],
+  });
+
+  testStartsProfileManager();
+});
--- a/toolkit/profile/xpcshell/xpcshell.ini
+++ b/toolkit/profile/xpcshell/xpcshell.ini
@@ -23,8 +23,9 @@ skip-if = devedition
 [test_use_dedicated.js]
 [test_new_default.js]
 [test_steal_inuse.js]
 [test_snap.js]
 [test_snap_empty.js]
 [test_remove_default.js]
 [test_claim_locked.js]
 [test_lock.js]
+[test_startswithlast.js]