Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var.

This adds an addition to the environment set up for child processes
(plugin container) so that it may still be able to pass the omni
parameters there as-needed.
This commit is contained in:
wolfbeast 2020-02-14 17:06:30 +01:00 • committed by Roy Tam
commit 113362d3b3
2 changed files with 39 additions and 34 deletions

View file

@ -712,6 +712,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
if (Omnijar::IsInitialized()) { if (Omnijar::IsInitialized()) {
// Make sure that child processes can find the omnijar // Make sure that child processes can find the omnijar
// See XRE_InitCommandLine in nsAppRunner.cpp // See XRE_InitCommandLine in nsAppRunner.cpp
newEnvVars["UXP_CUSTOM_OMNI"] = 1;
nsAutoCString path; nsAutoCString path;
nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE); nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE);
if (file && NS_SUCCEEDED(file->GetNativePath(path))) { if (file && NS_SUCCEEDED(file->GetNativePath(path))) {

View file

@ -4139,6 +4139,8 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
delete[] canonArgs; delete[] canonArgs;
#endif #endif
if (PR_GetEnv("UXP_CUSTOM_OMNI")) {
// Process CLI parameters for specifying custom omnijars
const char *path = nullptr; const char *path = nullptr;
ArgResult ar = CheckArg("greomni", true, &path); ArgResult ar = CheckArg("greomni", true, &path);
if (ar == ARG_BAD) { if (ar == ARG_BAD) {
@ -4178,6 +4180,8 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
} }
mozilla::Omnijar::Init(greOmni, appOmni); mozilla::Omnijar::Init(greOmni, appOmni);
} // UXP_CUSTOM_OMNI
return rv; return rv;
} }