Bug 1484059 p1 - Pass both the profile name and the profile dir in initGecko() r=jchen a=pascalc
authorEdouard Oger <eoger@fastmail.com>
Fri, 05 Oct 2018 03:15:41 +0000
changeset 492841 cfaf1ec5c361acbfb7d637ca9630a8a77d0d4b48
parent 492840 3c7440cdf2d58848df8aeece6e31aab206c16098
child 492842 4d163a122200d3f74e9782baf26a38bcefab8636
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen, pascalc
bugs1484059
milestone63.0
Bug 1484059 p1 - Pass both the profile name and the profile dir in initGecko() r=jchen a=pascalc GeckoProfile.initFromArgs is called using the values set in initGecko. initFromArgs will then only recognize a profileDir, leave profileName null, and then call GeckoProfile.get who will then create a "Custom (anonymous) profile with specified dir." type of GeckoProfile, which is incorrect. We fix the profile by specifying both -profile and -P in the args string. Differential Revision: https://phabricator.services.mozilla.com/D7671
mobile/android/base/java/org/mozilla/gecko/GeckoService.java
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoService.java
@@ -194,20 +194,24 @@ public abstract class GeckoService exten
 
         if (GeckoApplication.getRuntime() != null) {
             // Gecko has already been initialized, make sure it's using the
             // expected profile.
             return GeckoThread.canUseProfile(profileName,
                     profileDir != null ? new File(profileDir) : null);
         }
 
-        String args;
+        StringBuilder args = new StringBuilder();
         if (profileDir != null) {
-            args = "-profile " + profileDir;
-        } else {
-            args = "-P " + profileName;
+            args.append("-profile ").append(profileDir);
+        }
+        if (profileName != null) {
+            if (args.length() > 0) {
+                args.append(' ');
+            }
+            args.append("-P ").append(profileName);
         }
 
-        intent.putExtra(GeckoThread.EXTRA_ARGS, args);
+        intent.putExtra(GeckoThread.EXTRA_ARGS, args.toString());
         GeckoApplication.createRuntime(this, new SafeIntent(intent));
         return true;
     }
 }