Bug 1442255 - 1. Replace setLastIntent with extras bundle; r=esawin
☠☠ backed out by b1dc3a24a077 ☠ ☠
authorJim Chen <nchen@mozilla.com>
Tue, 06 Mar 2018 00:04:55 -0500
changeset 461720 d7a43e59a1b4ea7c294e7645c4f77d798fe7be67
parent 461711 575562183a3bc245c50dcf45d8dc21043b4565ae
child 461721 08f906f3a0c836d333699f528f70a6b86a69f5eb
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1442255
milestone60.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 1442255 - 1. Replace setLastIntent with extras bundle; r=esawin GeckoLoader.setLastIntent is not a very good API for setting environment variables and is often forgotten. Replace it with an extras bundle that is passed to setupGeckoEnvironment. MozReview-Commit-ID: IFhHjLdwFC5
mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java
@@ -10,28 +10,28 @@ import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.util.Locale;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
 import android.content.Context;
 import android.content.Intent;
 import android.os.Build;
+import android.os.Bundle;
 import android.os.Environment;
 import java.util.ArrayList;
 import android.util.Log;
 
 import org.mozilla.gecko.annotation.JNITarget;
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.geckoview.BuildConfig;
 
 public final class GeckoLoader {
     private static final String LOGTAG = "GeckoLoader";
 
-    private static volatile SafeIntent sIntent;
     private static File sCacheFile;
     private static File sGREDir;
 
     /* Synchronized on GeckoLoader.class. */
     private static boolean sSQLiteLibsLoaded;
     private static boolean sNSSLibsLoaded;
     private static boolean sMozGlueLoaded;
     private static String[] sEnvList;
@@ -86,40 +86,36 @@ public final class GeckoLoader {
         // check if the old tmp dir is there
         File oldDir = new File(tmpDir.getParentFile(), "app_tmp");
         if (oldDir.exists()) {
             delTree(oldDir);
         }
         return tmpDir;
     }
 
-    public static void setLastIntent(SafeIntent intent) {
-        sIntent = intent;
-    }
-
     public static void addEnvironmentToIntent(Intent intent) {
         if (sEnvList != null) {
             for (int ix = 0; ix < sEnvList.length; ix++) {
                 intent.putExtra("env" + ix, sEnvList[ix]);
             }
         }
     }
 
-    public static void setupGeckoEnvironment(Context context, String profilePath) {
+    public static void setupGeckoEnvironment(final Context context, final String profilePath,
+                                             final Bundle extras) {
         // if we have an intent (we're being launched by an activity)
         // read in any environmental variables from it here
-        final SafeIntent intent = sIntent;
-        if (intent != null) {
+        if (extras != null) {
             final ArrayList<String> envList = new ArrayList<String>();
-            String env = intent.getStringExtra("env0");
+            String env = extras.getString("env0");
             Log.d(LOGTAG, "Gecko environment env0: " + env);
             for (int c = 1; env != null; c++) {
                 envList.add(env);
                 putenv(env);
-                env = intent.getStringExtra("env" + c);
+                env = extras.getString("env" + c);
                 Log.d(LOGTAG, "env" + c + ": " + env);
             }
             if (envList.size() > 0) {
               sEnvList = envList.toArray(new String[envList.size()]);
             }
         }
 
         try {
@@ -155,19 +151,16 @@ public final class GeckoLoader {
             android.os.UserManager um = (android.os.UserManager)context.getSystemService(Context.USER_SERVICE);
             if (um != null) {
                 putenv("MOZ_ANDROID_USER_SERIAL_NUMBER=" + um.getSerialNumberForUser(android.os.Process.myUserHandle()));
             } else {
                 Log.d(LOGTAG, "Unable to obtain user manager service on a device with SDK version " + Build.VERSION.SDK_INT);
             }
         }
         setupLocaleEnvironment();
-
-        // We don't need this any more.
-        sIntent = null;
     }
 
     private static void loadLibsSetupLocked(Context context) {
         // The package data lib directory isn't placed in ld.so's
         // search path, so we have to manually load libraries that
         // libxul will depend on.  Not ideal.
 
         File cacheFile = getCacheDir(context);