mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
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:
parent
a70bdf58db
commit
113362d3b3
2 changed files with 39 additions and 34 deletions
|
|
@ -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))) {
|
||||||
|
|
|
||||||
|
|
@ -4139,45 +4139,49 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
|
||||||
delete[] canonArgs;
|
delete[] canonArgs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *path = nullptr;
|
if (PR_GetEnv("UXP_CUSTOM_OMNI")) {
|
||||||
ArgResult ar = CheckArg("greomni", true, &path);
|
// Process CLI parameters for specifying custom omnijars
|
||||||
if (ar == ARG_BAD) {
|
const char *path = nullptr;
|
||||||
PR_fprintf(PR_STDERR,
|
ArgResult ar = CheckArg("greomni", true, &path);
|
||||||
"Error: argument --greomni requires a path argument or the "
|
if (ar == ARG_BAD) {
|
||||||
"--osint argument was specified with the --greomni argument "
|
PR_fprintf(PR_STDERR,
|
||||||
"which is invalid.\n");
|
"Error: argument --greomni requires a path argument or the "
|
||||||
return NS_ERROR_FAILURE;
|
"--osint argument was specified with the --greomni argument "
|
||||||
}
|
"which is invalid.\n");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> greOmni;
|
nsCOMPtr<nsIFile> greOmni;
|
||||||
rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni));
|
rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n");
|
PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
ar = CheckArg("appomni", true, &path);
|
ar = CheckArg("appomni", true, &path);
|
||||||
if (ar == ARG_BAD) {
|
if (ar == ARG_BAD) {
|
||||||
PR_fprintf(PR_STDERR,
|
PR_fprintf(PR_STDERR,
|
||||||
"Error: argument --appomni requires a path argument or the "
|
"Error: argument --appomni requires a path argument or the "
|
||||||
"--osint argument was specified with the --appomni argument "
|
"--osint argument was specified with the --appomni argument "
|
||||||
"which is invalid.\n");
|
"which is invalid.\n");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> appOmni;
|
nsCOMPtr<nsIFile> appOmni;
|
||||||
if (path) {
|
if (path) {
|
||||||
rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni));
|
rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n");
|
PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mozilla::Omnijar::Init(greOmni, appOmni);
|
||||||
|
} // UXP_CUSTOM_OMNI
|
||||||
|
|
||||||
mozilla::Omnijar::Init(greOmni, appOmni);
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue