Bug 927451 - GeckoView profile folder is not created r=blassey r=wesj
authorMark Finkle <mfinkle@mozilla.com>
Wed, 16 Oct 2013 17:02:39 -0400
changeset 165810 723aed267eb044ffae88bf93d404d45b26e78206
parent 165809 780abea72b55d6c114a2a4ab1d51add4af853fda
child 165811 85fc49eda28abe327690b2318cd1b0126c5e7742
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey, wesj
bugs927451
milestone27.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 927451 - GeckoView profile folder is not created r=blassey r=wesj
mobile/android/base/GeckoProfile.java
mobile/android/base/GeckoView.java
--- a/mobile/android/base/GeckoProfile.java
+++ b/mobile/android/base/GeckoProfile.java
@@ -308,34 +308,39 @@ public final class GeckoProfile {
         }
     }
 
     public String getName() {
         return mName;
     }
 
     public synchronized File getDir() {
+        forceCreate();
+        return mDir;
+    }
+
+    public synchronized GeckoProfile forceCreate() {
         if (mDir != null) {
-            return mDir;
+            return this;
         }
 
         try {
             // Check if a profile with this name already exists.
             File mozillaDir = ensureMozillaDirectory(mContext);
             mDir = findProfileDir(mozillaDir);
             if (mDir == null) {
                 // otherwise create it
                 mDir = createProfileDir(mozillaDir);
             } else {
                 Log.d(LOGTAG, "Found profile dir: " + mDir.getAbsolutePath());
             }
         } catch (IOException ioe) {
             Log.e(LOGTAG, "Error getting profile dir", ioe);
         }
-        return mDir;
+        return this;
     }
 
     public File getFile(String aFile) {
         File f = getDir();
         if (f == null)
             return null;
 
         return new File(f, aFile);
--- a/mobile/android/base/GeckoView.java
+++ b/mobile/android/base/GeckoView.java
@@ -71,17 +71,17 @@ public class GeckoView extends LayerView
             Tabs tabs = Tabs.getInstance();
             tabs.attachToContext(context);
         }
         GeckoAppShell.registerEventListener("Gecko:Ready", this);
 
         ThreadUtils.setUiThread(Thread.currentThread(), new Handler());
         initializeView(GeckoAppShell.getEventDispatcher());
 
-        GeckoProfile profile = GeckoProfile.get(context);
+        GeckoProfile profile = GeckoProfile.get(context).forceCreate();
         BrowserDB.initialize(profile.getName());
 
         if (GeckoThread.checkAndSetLaunchState(GeckoThread.LaunchState.Launching, GeckoThread.LaunchState.Launched)) {
             GeckoAppShell.setLayerView(this);
             GeckoThread.createAndStart();
         }
     }