Bug 901903 - Don't try to fetch guest profile if it doesn't exist. r=wesj a=akeybl
authorBrian Nicholson <bnicholson@mozilla.com>
Wed, 14 Aug 2013 09:07:00 -0700
changeset 154001 375a555c99b2a9af930c2953a557c08625f6ba1e
parent 154000 2a747593db9b7ca643bd8309e05b8e1db22510f0
child 154002 7ebc7be739cec0beb61ca386b8bdc279784df2e7
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, akeybl
bugs901903
milestone25.0a2
Bug 901903 - Don't try to fetch guest profile if it doesn't exist. r=wesj a=akeybl
mobile/android/base/GeckoProfile.java
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -158,17 +158,17 @@ public final class GeckoProfile {
         GeckoProfile profile = getGuestProfile(context);
         if (profile != null) {
             profile.unlock();
         }
     }
 
     private static File getGuestDir(Context context) {
         if (mGuestDir == null) {
-            mGuestDir = context.getDir("guest", Context.MODE_PRIVATE);
+            mGuestDir = context.getFileStreamPath("guest");
         }
         return mGuestDir;
     }
 
     private static GeckoProfile getGuestProfile(Context context) {
         if (mGuestProfile == null) {
             File guestDir = getGuestDir(context);
             mGuestProfile = get(context, "guest", guestDir);
@@ -176,18 +176,22 @@ public final class GeckoProfile {
         }
 
         return mGuestProfile;
     }
 
     public static boolean maybeCleanupGuestProfile(final Context context) {
         // Don't use profile.getDir() here, so that we don't accidently create the dir
         File guestDir = getGuestDir(context);
+        if (!guestDir.exists()) {
+            return false;
+        }
+
         final GeckoProfile profile = getGuestProfile(context);
-        if (guestDir.exists() && !profile.locked()) {
+        if (!profile.locked()) {
             // if the guest dir exists, but its unlocked, delete it
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
                 public void run() {
                     removeGuestProfile(context);
                 }
             });
             return true;