diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-02-14 12:35:58 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-02-14 12:35:58 +0100 |
commit | 2bdbca39b210e3f13ae42ccae36935d30b36eb31 (patch) | |
tree | 6b5bf9d0e4e4db930a03f2ed999048c604aa5581 /toolkit/xre/nsAppRunner.cpp | |
parent | 8ec76186334df9dc87fc8aa7aa5edc84d977d776 (diff) | |
download | UXP-2bdbca39b210e3f13ae42ccae36935d30b36eb31.tar UXP-2bdbca39b210e3f13ae42ccae36935d30b36eb31.tar.gz UXP-2bdbca39b210e3f13ae42ccae36935d30b36eb31.tar.lz UXP-2bdbca39b210e3f13ae42ccae36935d30b36eb31.tar.xz UXP-2bdbca39b210e3f13ae42ccae36935d30b36eb31.zip |
Issue #1441 - Guard appomni/greomni with UXP_CUSTOM_OMNI env var.
Diffstat (limited to 'toolkit/xre/nsAppRunner.cpp')
-rw-r--r-- | toolkit/xre/nsAppRunner.cpp | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index b27e46697..d8f95c2a8 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -4131,45 +4131,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; } |