We set up the appropriate environment variables for gecko here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#116 and then explicitly load it here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#179 If we load libxul, as is happening in bug 1892234, before the explicit load we will run any C++ constructors before the environment variables are set. I noticed this because it was happening for [DefaultJitOptions](https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/js/src/jit/JitOptions.h#174)
Bug 1900106 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Currently we're loading libxul via glean (bug 1892234) instead of explicitly in GeckoLoader. This causes us to run C++ constructors before we setup the environment variables that we want for Gecko. We set up the appropriate environment variables for gecko here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#116 Then explicitly load libxul here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#179 I noticed this because it was happening for [DefaultJitOptions](https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/js/src/jit/JitOptions.h#174)
GeckoView has the ability to setup environment variables via a [config file](https://firefox-source-docs.mozilla.org/mobile/android/geckoview/consumer/automation.html#reading-configuration-from-a-file). Currently we're loading libxul via glean (bug 1892234) instead of explicitly in GeckoLoader. This causes us to run C++ constructors before we setup the environment variables that we want for Gecko. We set up the appropriate environment variables for gecko here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#116 Then explicitly load libxul here: https://searchfox.org/mozilla-central/rev/fc76676f61ee37b4c5420649cad6677164a29405/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#179 I noticed this because it was happening for [DefaultJitOptions](https://searchfox.org/mozilla-central/rev/5ff3324fe989a19c6fa5ac5b923089ef4ce2ebb2/js/src/jit/JitOptions.h#174) It's also worth noting that this causes inconsistent results for the environment variables in the parent process and the content process.