Bug 1527851: Continue to use dev-edition-default as the default profile name for developer edition. r=froydnj
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 28 Feb 2019 15:36:22 +0000
changeset 519677 8540d6d786fd55bf7e00069d039692fc0222de9c
parent 519676 cc20c56545bd250c3c0f1bdc67de3d77fee2ce42
child 519678 357281e408cf32115a1306f7ca660cf8e6445301
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1527851
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 1527851: Continue to use dev-edition-default as the default profile name for developer edition. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D21452
toolkit/profile/nsToolkitProfileService.cpp
toolkit/profile/xpcshell/head.js
toolkit/profile/xpcshell/test_skip_locked_environment.js
toolkit/profile/xpcshell/test_update_unknown_dedicated.js
toolkit/profile/xpcshell/test_update_unselected_dedicated.js
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -791,20 +791,20 @@ nsresult nsToolkitProfileService::GetPro
   }
 
   return NS_OK;
 }
 
 nsresult nsToolkitProfileService::CreateDefaultProfile(nsIToolkitProfile** aResult) {
   // Create a new default profile
   nsAutoCString name;
-  if (mUseDedicatedProfile) {
+  if (mUseDevEditionProfile) {
+    name.AssignLiteral(DEV_EDITION_NAME);
+  } else if (mUseDedicatedProfile) {
     name.AssignLiteral("default-" NS_STRINGIFY(MOZ_UPDATE_CHANNEL));
-  } else if (mUseDevEditionProfile) {
-    name.AssignLiteral(DEV_EDITION_NAME);
   } else {
     name.AssignLiteral(DEFAULT_NAME);
   }
 
   nsresult rv = CreateUniqueProfile(nullptr, name, aResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (mUseDedicatedProfile) {
--- a/toolkit/profile/xpcshell/head.js
+++ b/toolkit/profile/xpcshell/head.js
@@ -65,22 +65,21 @@ function simulateSnapEnvironment() {
 }
 
 function getProfileService() {
   return Cc["@mozilla.org/toolkit/profile-service;1"].
          getService(Ci.nsIToolkitProfileService);
 }
 
 let PROFILE_DEFAULT = "default";
+let DEDICATED_NAME = `default-${AppConstants.MOZ_UPDATE_CHANNEL}`;
 if (AppConstants.MOZ_DEV_EDITION) {
-  PROFILE_DEFAULT = "dev-edition-default";
+  DEDICATED_NAME = PROFILE_DEFAULT = "dev-edition-default";
 }
 
-let DEDICATED_NAME = `default-${AppConstants.MOZ_UPDATE_CHANNEL}`;
-
 /**
  * Creates a random profile path for use.
  */
 function makeRandomProfileDir(name) {
   let file = gDataHome.clone();
   file.append(name);
   file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
   return file;
--- a/toolkit/profile/xpcshell/test_skip_locked_environment.js
+++ b/toolkit/profile/xpcshell/test_skip_locked_environment.js
@@ -45,39 +45,37 @@ add_task(async () => {
   let env = Cc["@mozilla.org/process/environment;1"].
             getService(Ci.nsIEnvironment);
   env.set("XRE_PROFILE_PATH", root.path);
   env.set("XRE_PROFILE_LOCAL_PATH", local.path);
 
   let { rootDir, localDir, profile, didCreate } = selectStartupProfile();
   checkStartupReason("restart-skipped-default");
 
+  // Since there is already a profile with the desired name on dev-edition, a
+  // unique version will be used.
+  let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
+
   Assert.ok(didCreate, "Should have created a new profile.");
   Assert.ok(!rootDir.equals(root), "Should have selected the right root dir.");
   Assert.ok(!localDir.equals(local), "Should have selected the right local dir.");
   Assert.ok(profile, "A named profile was returned.");
-  Assert.equal(profile.name, DEDICATED_NAME, "The right profile name was used.");
+  Assert.equal(profile.name, expectedName, "The right profile name was used.");
 
   let service = getProfileService();
   Assert.equal(service.defaultProfile, profile, "Should be the default profile.");
   Assert.equal(service.currentProfile, profile, "Should be the current profile.");
 
   profileData = readProfilesIni();
 
-  if (!AppConstants.MOZ_DEV_EDITION) {
-    // On non-dev-edition builds the first two profiles are in the opposite order.
-    [profileData.profiles[1], profileData.profiles[0]] =
-        [profileData.profiles[0], profileData.profiles[1]];
-  }
-
-  Assert.equal(profileData.profiles[0].name, DEDICATED_NAME, "Should be the right profile.");
-  Assert.ok(!profileData.profiles[0].default, "Should not be the old default profile.");
-  Assert.equal(profileData.profiles[1].name, PROFILE_DEFAULT, "Should be the right profile.");
-  Assert.ok(profileData.profiles[1].default, "Should be the old default profile.");
-  Assert.equal(profileData.profiles[1].path, root.leafName, "Should be the correct path.");
+  Assert.equal(profileData.profiles[0].name, PROFILE_DEFAULT, "Should be the right profile.");
+  Assert.ok(profileData.profiles[0].default, "Should be the old default profile.");
+  Assert.equal(profileData.profiles[0].path, root.leafName, "Should be the correct path.");
+  Assert.equal(profileData.profiles[1].name, expectedName, "Should be the right profile.");
+  Assert.ok(!profileData.profiles[1].default, "Should not be the old default profile.");
 
   let hash = xreDirProvider.getInstallHash();
   installData = readInstallsIni();
   Assert.equal(Object.keys(installData.installs).length, 2, "Should be one known install.");
   Assert.notEqual(installData.installs[hash].default, root.leafName, "Should have marked the original default profile as the default for this install.");
   Assert.ok(installData.installs[hash].locked, "Should have locked as we created the profile for this install.");
   Assert.equal(installData.installs.otherinstall.default, root.leafName, "Should have left the other profile as the default for the other install.");
   Assert.ok(installData.installs[hash].locked, "Should still be locked to the other install.");
--- a/toolkit/profile/xpcshell/test_update_unknown_dedicated.js
+++ b/toolkit/profile/xpcshell/test_update_unknown_dedicated.js
@@ -21,33 +21,32 @@ add_task(async () => {
   checkStartupReason("firstrun-created-default");
 
   let profileData = readProfilesIni();
   let installData = readInstallsIni();
 
   Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
   Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
 
-  // The name ordering is different for dev edition.
-  if (AppConstants.MOZ_DEV_EDITION) {
-    profileData.profiles.reverse();
-  }
+  // Since there is already a profile with the desired name on dev-edition, a
+  // unique version will be used.
+  let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
 
   let profile = profileData.profiles[0];
   Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
   Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
   Assert.ok(profile.default, "Should be marked as the old-style default.");
   profile = profileData.profiles[1];
-  Assert.equal(profile.name, DEDICATED_NAME, "Should have the right name.");
+  Assert.equal(profile.name, expectedName, "Should have the right name.");
   Assert.notEqual(profile.path, defaultProfile.leafName, "Should not be the original default profile.");
   Assert.ok(!profile.default, "Should not be marked as the old-style default.");
 
   Assert.equal(Object.keys(installData.installs).length, 1, "Should be a default for installs.");
   Assert.equal(installData.installs[hash].default, profile.path, "Should have the right default profile.");
   Assert.ok(installData.installs[hash].locked, "Should have locked as we created this profile for this install.");
 
   checkProfileService(profileData, installData);
 
   Assert.ok(didCreate, "Should have created a new profile.");
   Assert.ok(!service.createdAlternateProfile, "Should not have created an alternate profile.");
   Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should not be using the old directory.");
-  Assert.equal(selectedProfile.name, DEDICATED_NAME);
+  Assert.equal(selectedProfile.name, expectedName);
 });
--- a/toolkit/profile/xpcshell/test_update_unselected_dedicated.js
+++ b/toolkit/profile/xpcshell/test_update_unselected_dedicated.js
@@ -25,33 +25,32 @@ add_task(async () => {
   checkStartupReason("firstrun-skipped-default");
 
   let profileData = readProfilesIni();
   let installData = readInstallsIni();
 
   Assert.ok(profileData.options.startWithLastProfile, "Should be set to start with the last profile.");
   Assert.equal(profileData.profiles.length, 2, "Should have the right number of profiles.");
 
-  // The name ordering is different for dev edition.
-  if (AppConstants.MOZ_DEV_EDITION) {
-    profileData.profiles.reverse();
-  }
+  // Since there is already a profile with the desired name on dev-edition, a
+  // unique version will be used.
+  let expectedName = AppConstants.MOZ_DEV_EDITION ? `${DEDICATED_NAME}-1` : DEDICATED_NAME;
 
   let profile = profileData.profiles[0];
   Assert.equal(profile.name, PROFILE_DEFAULT, "Should have the right name.");
   Assert.equal(profile.path, defaultProfile.leafName, "Should be the original default profile.");
   Assert.ok(profile.default, "Should be marked as the old-style default.");
   profile = profileData.profiles[1];
-  Assert.equal(profile.name, DEDICATED_NAME, "Should have the right name.");
+  Assert.equal(profile.name, expectedName, "Should have the right name.");
   Assert.notEqual(profile.path, defaultProfile.leafName, "Should not be the original default profile.");
   Assert.ok(!profile.default, "Should not be marked as the old-style default.");
 
   Assert.equal(Object.keys(installData.installs).length, 1, "Should be a default for this install.");
   Assert.equal(installData.installs[hash].default, profile.path, "Should have marked the new profile as the default for this install.");
   Assert.ok(installData.installs[hash].locked, "Should have locked as we created this profile for this install.");
 
   checkProfileService(profileData, installData);
 
   Assert.ok(didCreate, "Should have created a new profile.");
   Assert.ok(service.createdAlternateProfile, "Should have created an alternate profile.");
   Assert.ok(!selectedProfile.rootDir.equals(defaultProfile), "Should be using the right directory.");
-  Assert.equal(selectedProfile.name, DEDICATED_NAME);
+  Assert.equal(selectedProfile.name, expectedName);
 });