summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-02-14 17:06:30 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-02-15 13:20:36 +0100
commitceb9d0ad92ac1fc0d5844310f7542e397cdd8f05 (patch)
tree6939860e48eb9a6db22406ff672821145727d7f9
parentf16336a10d36f18eb55efb1d62c7205de9e916c4 (diff)
downloadUXP-ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05.tar
UXP-ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05.tar.gz
UXP-ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05.tar.lz
UXP-ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05.tar.xz
UXP-ceb9d0ad92ac1fc0d5844310f7542e397cdd8f05.zip
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.
-rw-r--r--ipc/glue/GeckoChildProcessHost.cpp1
-rw-r--r--toolkit/xre/nsAppRunner.cpp72
2 files changed, 39 insertions, 34 deletions
diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp
index ea76f85f0..9e83a8729 100644
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -712,6 +712,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
if (Omnijar::IsInitialized()) {
// Make sure that child processes can find the omnijar
// See XRE_InitCommandLine in nsAppRunner.cpp
+ newEnvVars["UXP_CUSTOM_OMNI"] = 1;
nsAutoCString path;
nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE);
if (file && NS_SUCCEEDED(file->GetNativePath(path))) {
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 035d35a9d..441c4a373 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4118,45 +4118,49 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
delete[] canonArgs;
#endif
- const char *path = nullptr;
- ArgResult ar = CheckArg("greomni", true, &path);
- if (ar == ARG_BAD) {
- PR_fprintf(PR_STDERR,
- "Error: argument --greomni requires a path argument or the "
- "--osint argument was specified with the --greomni argument "
- "which is invalid.\n");
- return NS_ERROR_FAILURE;
- }
+ if (PR_GetEnv("UXP_CUSTOM_OMNI")) {
+ // Process CLI parameters for specifying custom omnijars
+ const char *path = nullptr;
+ ArgResult ar = CheckArg("greomni", true, &path);
+ if (ar == ARG_BAD) {
+ PR_fprintf(PR_STDERR,
+ "Error: argument --greomni requires a path argument or the "
+ "--osint argument was specified with the --greomni argument "
+ "which is invalid.\n");
+ return NS_ERROR_FAILURE;
+ }
- if (!path)
- return rv;
+ if (!path)
+ return rv;
- nsCOMPtr<nsIFile> greOmni;
- rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni));
- if (NS_FAILED(rv)) {
- PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n");
- return rv;
- }
+ nsCOMPtr<nsIFile> greOmni;
+ rv = XRE_GetFileFromPath(path, getter_AddRefs(greOmni));
+ if (NS_FAILED(rv)) {
+ PR_fprintf(PR_STDERR, "Error: argument --greomni requires a valid path\n");
+ return rv;
+ }
- ar = CheckArg("appomni", true, &path);
- if (ar == ARG_BAD) {
- PR_fprintf(PR_STDERR,
- "Error: argument --appomni requires a path argument or the "
- "--osint argument was specified with the --appomni argument "
- "which is invalid.\n");
- return NS_ERROR_FAILURE;
- }
+ ar = CheckArg("appomni", true, &path);
+ if (ar == ARG_BAD) {
+ PR_fprintf(PR_STDERR,
+ "Error: argument --appomni requires a path argument or the "
+ "--osint argument was specified with the --appomni argument "
+ "which is invalid.\n");
+ return NS_ERROR_FAILURE;
+ }
- nsCOMPtr<nsIFile> appOmni;
- if (path) {
- rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni));
- if (NS_FAILED(rv)) {
- PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n");
- return rv;
- }
- }
+ nsCOMPtr<nsIFile> appOmni;
+ if (path) {
+ rv = XRE_GetFileFromPath(path, getter_AddRefs(appOmni));
+ if (NS_FAILED(rv)) {
+ PR_fprintf(PR_STDERR, "Error: argument --appomni requires a valid path\n");
+ return rv;
+ }
+ }
+
+ mozilla::Omnijar::Init(greOmni, appOmni);
+ } // UXP_CUSTOM_OMNI
- mozilla::Omnijar::Init(greOmni, appOmni);
return rv;
}