Bug 804303 part 4 - Set environment variables earlier on Android. r=blassey,r=wesj

This commit is contained in:
Mike Hommey 2012-12-07 09:32:24 +01:00
parent d631bf6223
commit 580138ee52
2 changed files with 22 additions and 16 deletions

View File

@ -1416,7 +1416,7 @@ abstract public class GeckoApp
enableStrictMode();
}
GeckoAppShell.loadMozGlue();
GeckoAppShell.loadMozGlue(this);
if (sGeckoThread != null) {
// this happens when the GeckoApp activity is destroyed by android
// without killing the entire application (see bug 769269)

View File

@ -418,18 +418,6 @@ public class GeckoAppShell
// profile home path
GeckoAppShell.putenv("HOME=" + profile.getFilesDir().getPath());
Intent i = null;
i = ((Activity)context).getIntent();
// if we have an intent (we're being launched by an activity)
// read in any environmental variables from it here
String env = i.getStringExtra("env0");
Log.d(LOGTAG, "Gecko environment env0: "+ env);
for (int c = 1; env != null; c++) {
GeckoAppShell.putenv(env);
env = i.getStringExtra("env" + c);
Log.d(LOGTAG, "env" + c + ": " + env);
}
// setup the tmp path
File f = context.getDir("tmp", Context.MODE_WORLD_READABLE |
Context.MODE_WORLD_WRITEABLE );
@ -484,7 +472,7 @@ public class GeckoAppShell
synchronized(sSQLiteLibsLoaded) {
if (sSQLiteLibsLoaded)
return;
loadMozGlue();
loadMozGlue(context);
// the extract libs parameter is being removed in bug 732069
loadLibsSetup(context);
loadSQLiteLibsNative(apkName, false);
@ -498,15 +486,33 @@ public class GeckoAppShell
synchronized(sNSSLibsLoaded) {
if (sNSSLibsLoaded)
return;
loadMozGlue();
loadMozGlue(context);
loadLibsSetup(context);
loadNSSLibsNative(apkName, false);
sNSSLibsLoaded = true;
}
}
public static void loadMozGlue() {
public static void loadMozGlue(Context context) {
System.loadLibrary("mozglue");
// When running TestPasswordProvider, we're being called with
// a GeckoApplication, which is not an Activity
if (!(context instanceof Activity))
return;
Intent i = null;
i = ((Activity)context).getIntent();
// if we have an intent (we're being launched by an activity)
// read in any environmental variables from it here
String env = i.getStringExtra("env0");
Log.d(LOGTAG, "Gecko environment env0: "+ env);
for (int c = 1; env != null; c++) {
GeckoAppShell.putenv(env);
env = i.getStringExtra("env" + c);
Log.d(LOGTAG, "env" + c + ": " + env);
}
}
public static void loadGeckoLibs(String apkName) {