Bug 278860 - Show the right error message when the profile is missing; r=bsmedberg a=mfinkle
authorMichael Kaply <mozilla@kaply.com>
Thu, 19 Apr 2012 15:40:49 -0400
changeset 95305 d665f2ad8a78e0917943f342c779ae78fe2285f1
parent 95304 03a334471fa35163774699f523a53a1c2fa9865a
child 95306 473904bdde306fc4b64337db1457e9d565dd8c71
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, mfinkle
bugs278860
milestone14.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 278860 - Show the right error message when the profile is missing; r=bsmedberg a=mfinkle
toolkit/profile/content/profileSelection.js
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/profile/content/profileSelection.js
+++ b/toolkit/profile/content/profileSelection.js
@@ -116,16 +116,24 @@ function acceptDialog()
   }
 
   var profileLock;
 
   try {
     profileLock = selectedProfile.profile.lock({ value: null });
   }
   catch (e) {
+    if (!selectedProfile.profile.localDir.exists()) {
+      var missingTitle = gProfileManagerBundle.getString("profileMissingTitle");
+      var missing =
+        gProfileManagerBundle.getFormattedString("profileMissing", [appName]);
+      gPromptService.alert(window, missingTitle, missing);
+      return false;
+    }
+
     var lockedTitle = gProfileManagerBundle.getString("profileLockedTitle");
     var locked =
       gProfileManagerBundle.getFormattedString("profileLocked2", [appName, selectedProfile.profile.name, appName]);
     Services.prompt.alert(window, lockedTitle, locked);
 
     return false;
   }
   gDialogParams.objects.insertElementAt(profileLock.nsIProfileLock, 0, false);
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2192,16 +2192,22 @@ SelectProfile(nsIProfileLock* *aResult, 
       nsCOMPtr<nsILocalFile> profileDir;
       rv = profile->GetRootDir(getter_AddRefs(profileDir));
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsCOMPtr<nsILocalFile> profileLocalDir;
       rv = profile->GetLocalDir(getter_AddRefs(profileLocalDir));
       NS_ENSURE_SUCCESS(rv, rv);
 
+      bool exists;
+      profileLocalDir->Exists(&exists);
+      if (!exists) {
+        return ProfileMissingDialog(aNative);
+      }
+
       return ProfileLockedDialog(profileDir, profileLocalDir, unlocker,
                                  aNative, aResult);
     }
 
     return ShowProfileManager(aProfileSvc, aNative);
   }
 
   ar = CheckArg("profilemanager", true);
@@ -2266,16 +2272,22 @@ SelectProfile(nsIProfileLock* *aResult, 
       nsCOMPtr<nsILocalFile> profileDir;
       rv = profile->GetRootDir(getter_AddRefs(profileDir));
       NS_ENSURE_SUCCESS(rv, rv);
 
       nsCOMPtr<nsILocalFile> profileLocalDir;
       rv = profile->GetRootDir(getter_AddRefs(profileLocalDir));
       NS_ENSURE_SUCCESS(rv, rv);
 
+      bool exists;
+      profileLocalDir->Exists(&exists);
+      if (!exists) {
+        return ProfileMissingDialog(aNative);
+      }
+
       return ProfileLockedDialog(profileDir, profileLocalDir, unlocker,
                                  aNative, aResult);
     }
   }
 
   return ShowProfileManager(aProfileSvc, aNative);
 }