From 7950aa089402c51fca2d4bf0a2455ac97b04cbd5 Mon Sep 17 00:00:00 2001 From: Greg Stoll Date: Fri, 7 Oct 2022 19:22:45 +0000 Subject: [PATCH] Bug 1783304 - Simplify DLL blocklist init r=handyman Now that SetGeckoProcessType() is called earlier, we can use that to determine if we are a utility process instead of parsing command-line arguments Differential Revision: https://phabricator.services.mozilla.com/D158811 --- browser/app/nsBrowserApp.cpp | 8 +++----- ipc/app/MozillaRuntimeMain.cpp | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index e891482ef398..f106a2541abf 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -311,13 +311,11 @@ int main(int argc, char* argv[], char* envp[]) { # ifdef HAS_DLL_BLOCKLIST uint32_t initFlags = gBlocklistInitFlags | eDllBlocklistInitFlagIsChildProcess; -# if defined(MOZ_SANDBOX) - Maybe sandboxingKind = - geckoargs::sSandboxingKind.Get(argc, argv, CheckArgFlag::None); - if (sandboxingKind.isSome()) { + // This is too early in launch to call XRE_IsUtilityProcess(), so roll + // our own. + if (GetGeckoProcessType() == GeckoProcessType_Utility) { initFlags |= eDllBlocklistInitFlagIsUtilityProcess; } -# endif // defined(MOZ_SANDBOX) DllBlocklist_Initialize(initFlags); # endif // HAS_DLL_BLOCKLIST # if defined(XP_WIN) && defined(MOZ_SANDBOX) diff --git a/ipc/app/MozillaRuntimeMain.cpp b/ipc/app/MozillaRuntimeMain.cpp index d820d4d61480..25a50d8793a4 100644 --- a/ipc/app/MozillaRuntimeMain.cpp +++ b/ipc/app/MozillaRuntimeMain.cpp @@ -83,13 +83,11 @@ int main(int argc, char* argv[]) { #ifdef HAS_DLL_BLOCKLIST uint32_t initFlags = eDllBlocklistInitFlagIsChildProcess; -# if defined(MOZ_SANDBOX) - Maybe sandboxingKind = - geckoargs::sSandboxingKind.Get(argc, argv, CheckArgFlag::None); - if (sandboxingKind.isSome()) { + // This is too early in launch to call XRE_IsUtilityProcess(), so roll + // our own. + if (GetGeckoProcessType() == GeckoProcessType_Utility) { initFlags |= eDllBlocklistInitFlagIsUtilityProcess; } -# endif // defined(MOZ_SANDBOX) DllBlocklist_Initialize(initFlags); #endif