set portable envars when running firefox

This commit is contained in:
idk
2022-12-23 06:20:09 +00:00
parent 7d0a3145f0
commit 331b8a4864
5 changed files with 75 additions and 8 deletions

View File

@ -420,6 +420,7 @@ Linux(because the top command will be run and the script will exit).\n\nBoth det
<arg value="src/java/net/i2p/i2pfirefox/I2PChromiumProfileChecker.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PChromiumProfileUnpacker.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PFirefox.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PLibreWolf.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PFirefoxProfileBuilder.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PFirefoxProfileChecker.java"/>
<arg value="src/java/net/i2p/i2pfirefox/I2PFirefoxProfileUnpacker.java"/>

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Fri Dec 23 01:36:34 UTC 2022
build.number=418
#Fri Dec 23 03:06:30 UTC 2022
build.number=420

View File

@ -23,6 +23,11 @@
<target name="build" depends="jar" />
<target name="builddep">
</target>
<target name="cp">
<exec executable="echo">
<arg value="${java.class.path}"></arg>
</exec>
</target>
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.8" />

View File

@ -240,6 +240,16 @@ public class I2PFirefox extends I2PCommonBrowser {
private static String[] NEARBY_FIREFOX_SEARCH_PATHS() {
// obtain the PLUGIN environment variable
// crashreporterFolder := utl.CreateFolder(app.DataPath, "crashreporter")
// pluginsFolder := utl.CreateFolder(app.DataPath, "plugins")
SystemUtil.setenv("MOZ_CRASHREPORTER", "0");
SystemUtil.setenv("MOZ_CRASHREPORTER_DATA_DIRECTORY", crashreporterFolder);
SystemUtil.setenv("MOZ_CRASHREPORTER_DISABLE", "1");
SystemUtil.setenv("MOZ_CRASHREPORTER_NO_REPORT", "1");
SystemUtil.setenv("MOZ_DATA_REPORTING", "0");
SystemUtil.setenv("MOZ_MAINTENANCE_SERVICE", "0");
SystemUtil.setenv("MOZ_PLUGIN_PATH", pluginsFolder);
SystemUtil.setenv("MOZ_UPDATER", "0");
String plugin = System.getenv("PLUGIN");
if (plugin != null && !plugin.isEmpty()) {
File userDir = new File(plugin);
@ -593,20 +603,66 @@ public class I2PFirefox extends I2PCommonBrowser {
if (!bashScript.canExecute()) {
bashScript.setExecutable(true);
}
return new ProcessBuilder(bashScript.getAbsolutePath())
.directory(I2PFirefoxProfileBuilder.runtimeDirectory(true));
ProcessBuilder pb = new ProcessBuilder(bashScript.getAbsolutePath());
File rtd = I2PFirefoxProfileBuilder.runtimeDirectory(true);
pb.directory(rtd);
String crashreporterFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
String pluginsFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
pb.environment().put("MOZ_CRASHREPORTER", "0");
pb.environment().put("MOZ_CRASHREPORTER_DATA_DIRECTORY",
crashreporterFolder);
pb.environment().put("MOZ_CRASHREPORTER_DISABLE", "1");
pb.environment().put("MOZ_CRASHREPORTER_NO_REPORT", "1");
pb.environment().put("MOZ_DATA_REPORTING", "0");
pb.environment().put("MOZ_MAINTENANCE_SERVICE", "0");
pb.environment().put("MOZ_PLUGIN_PATH", pluginsFolder);
pb.environment().put("MOZ_UPDATER", "0");
return pb;
} catch (IOException e) {
logger.warning(e.toString());
}
return null;
} else {
return new ProcessBuilder(newArgs).directory(
I2PFirefoxProfileBuilder.runtimeDirectory(true));
ProcessBuilder pb = new ProcessBuilder(newArgs);
File rtd = I2PFirefoxProfileBuilder.runtimeDirectory(true);
pb.directory(rtd);
String crashreporterFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
String pluginsFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
pb.environment().put("MOZ_CRASHREPORTER", "0");
pb.environment().put("MOZ_CRASHREPORTER_DATA_DIRECTORY",
crashreporterFolder);
pb.environment().put("MOZ_CRASHREPORTER_DISABLE", "1");
pb.environment().put("MOZ_CRASHREPORTER_NO_REPORT", "1");
pb.environment().put("MOZ_DATA_REPORTING", "0");
pb.environment().put("MOZ_MAINTENANCE_SERVICE", "0");
pb.environment().put("MOZ_PLUGIN_PATH", pluginsFolder);
pb.environment().put("MOZ_UPDATER", "0");
return pb;
}
} // else {
logger.info("No Firefox found.");
return new ProcessBuilder(args);
ProcessBuilder pb = new ProcessBuilder(args);
File rtd = I2PFirefoxProfileBuilder.runtimeDirectory(true);
pb.directory(rtd);
String crashreporterFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
String pluginsFolder =
new File(rtd.getAbsolutePath(), "crashreporter").toString();
pb.environment().put("MOZ_CRASHREPORTER", "0");
pb.environment().put("MOZ_CRASHREPORTER_DATA_DIRECTORY",
crashreporterFolder);
pb.environment().put("MOZ_CRASHREPORTER_DISABLE", "1");
pb.environment().put("MOZ_CRASHREPORTER_NO_REPORT", "1");
pb.environment().put("MOZ_DATA_REPORTING", "0");
pb.environment().put("MOZ_MAINTENANCE_SERVICE", "0");
pb.environment().put("MOZ_PLUGIN_PATH", pluginsFolder);
pb.environment().put("MOZ_UPDATER", "0");
return pb;
//}
// return null;
}

View File

@ -1,4 +1,8 @@
package net.i2p.i2pfirefox;
import java.io.*;
import javax.script.*;
/**
* I2PLibreWolf.java
* Copyright (C) 2022 idk <hankhill19580@gmail.com>
@ -16,5 +20,6 @@ package net.i2p.i2pfirefox;
* @since 1.0.6
*/
public class I2PLibreWolf {
private static final ScriptEngineManager sem = new ScriptEngineManager();
private final ScriptEngine ee = sem.getEngineByName("Nashorn");
}