|
@@ -0,0 +1,158 @@
|
|
|
|
+# HG changeset patch
|
|
|
|
+# User Bill Gianopoulos <wgianopoulos@gmail.com>
|
|
|
|
+# Date 1723715420 0
|
|
|
|
+Bug 9999999 - Port bug 1908725 to suite.
|
|
|
|
+Bug 1908725 - Provide a never-reused PID alternative for all Gecko processes.
|
|
|
|
+
|
|
|
|
+diff --git a/suite/app/moz.build b/suite/app/moz.build
|
|
|
|
+--- a/suite/app/moz.build
|
|
|
|
++++ b/suite/app/moz.build
|
|
|
|
+@@ -13,17 +13,16 @@ if CONFIG['MOZ_NO_PIE_COMPAT']:
|
|
|
|
+ DIRS += ['no-pie']
|
|
|
|
+ else:
|
|
|
|
+ GeckoProgram(CONFIG['MOZ_APP_NAME'])
|
|
|
|
+
|
|
|
|
+ SOURCES += ["nsSuiteApp.cpp"]
|
|
|
|
+
|
|
|
|
+ LOCAL_INCLUDES += [
|
|
|
|
+ "!/build",
|
|
|
|
+- "/ipc/contentproc/",
|
|
|
|
+ "/toolkit/xre",
|
|
|
|
+ "/xpcom/base",
|
|
|
|
+ "/xpcom/build",
|
|
|
|
+ ]
|
|
|
|
+
|
|
|
|
+ if CONFIG["OS_ARCH"] == "WINNT":
|
|
|
|
+ RCINCLUDE = "splash.rc"
|
|
|
|
+ DEFINES["MOZ_SUITE"] = True
|
|
|
|
+diff --git a/suite/app/nsSuiteApp.cpp b/suite/app/nsSuiteApp.cpp
|
|
|
|
+--- a/suite/app/nsSuiteApp.cpp
|
|
|
|
++++ b/suite/app/nsSuiteApp.cpp
|
|
|
|
+@@ -29,19 +29,22 @@
|
|
|
|
+ #include <time.h>
|
|
|
|
+
|
|
|
|
+ #include "nsCOMPtr.h"
|
|
|
|
+ #include "nsIFile.h"
|
|
|
|
+
|
|
|
|
+ #ifdef XP_WIN
|
|
|
|
+ #include "mozilla/WindowsDllBlocklist.h"
|
|
|
|
+ #define XRE_WANT_ENVIRON
|
|
|
|
++#include "nsWindowsWMain.cpp"
|
|
|
|
++
|
|
|
|
+ #define strcasecmp _stricmp
|
|
|
|
+ #ifdef MOZ_SANDBOX
|
|
|
|
+ #include "mozilla/sandboxing/SandboxInitialization.h"
|
|
|
|
++#include "mozilla/sandboxing/sandboxLogging.h"
|
|
|
|
+ #endif
|
|
|
|
+ #endif
|
|
|
|
+ #include "BinaryPath.h"
|
|
|
|
+
|
|
|
|
+ #include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
|
|
|
+
|
|
|
|
+ #include "mozilla/Sprintf.h"
|
|
|
|
+ #include "mozilla/StartupTimeline.h"
|
|
|
|
+@@ -93,17 +96,16 @@ SSE2Check()
|
|
|
|
+ MOZ_ARRAY_LENGTH(sSSE2Message) - 1));
|
|
|
|
+ // _exit() instead of exit() to avoid running the usual "at exit" code.
|
|
|
|
+ _exit(255);
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+ #if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID)
|
|
|
|
+ #define MOZ_BROWSER_CAN_BE_CONTENTPROC
|
|
|
|
+-#include "plugin-container.cpp"
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+ using namespace mozilla;
|
|
|
|
+
|
|
|
|
+ #ifdef XP_MACOSX
|
|
|
|
+ #define kOSXResourcesFolder "Resources"
|
|
|
|
+ #endif
|
|
|
|
+ #define kDesktopFolder ""
|
|
|
|
+@@ -269,17 +271,18 @@ uint32_t gBlocklistInitFlags = eDllBlock
|
|
|
|
+
|
|
|
|
+ int main(int argc, char* argv[], char* envp[])
|
|
|
|
+ {
|
|
|
|
+ mozilla::TimeStamp start = mozilla::TimeStamp::Now();
|
|
|
|
+
|
|
|
|
+ #ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
|
|
|
|
+ // We are launching as a content process, delegate to the appropriate
|
|
|
|
+ // main
|
|
|
|
+- if (argc > 1 && IsArg(argv[1], "contentproc")) {
|
|
|
|
++
|
|
|
|
++ if (GetGeckoProcessType() != GeckoProcessType_Default) {
|
|
|
|
+ #ifdef HAS_DLL_BLOCKLIST
|
|
|
|
+ DllBlocklist_Initialize(eDllBlocklistInitFlagIsChildProcess);
|
|
|
|
+ #endif
|
|
|
|
+ #if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
|
|
|
+ // We need to initialize the sandbox TargetServices before InitXPCOMGlue
|
|
|
|
+ // because we might need the sandbox broker to give access to some files.
|
|
|
|
+ if (IsSandboxedProcess() && !sandboxing::GetInitializedTargetServices()) {
|
|
|
|
+ Output("Failed to initialize the sandbox target services.");
|
|
|
|
+@@ -287,22 +290,41 @@ int main(int argc, char* argv[], char* e
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+ nsresult rv = InitXPCOMGlue(LibLoadingStrategy::NoReadAhead);
|
|
|
|
+ if (NS_FAILED(rv)) {
|
|
|
|
+ return 255;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+- int result = content_process_main(gBootstrap.get(), argc, argv);
|
|
|
|
++ XREChildData childData;
|
|
|
|
++
|
|
|
|
++# if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
|
|
|
++ if (IsSandboxedProcess()) {
|
|
|
|
++ childData.sandboxTargetServices =
|
|
|
|
++ mozilla::sandboxing::GetInitializedTargetServices();
|
|
|
|
++ if (!childData.sandboxTargetServices) {
|
|
|
|
++ return 1;
|
|
|
|
++ }
|
|
|
|
+
|
|
|
|
++ childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
|
|
|
|
++ }
|
|
|
|
++
|
|
|
|
++ if (GetGeckoProcessType() == GeckoProcessType_RemoteSandboxBroker) {
|
|
|
|
++ childData.sandboxBrokerServices =
|
|
|
|
++ mozilla::sandboxing::GetInitializedBrokerServices();
|
|
|
|
++ }
|
|
|
|
++# endif
|
|
|
|
++
|
|
|
|
++ rv = gBootstrap->XRE_InitChildProcess(argc, argv, &childData);
|
|
|
|
++
|
|
|
|
+ // InitXPCOMGlue calls NS_LogInit, so we need to balance it here.
|
|
|
|
+ gBootstrap->NS_LogTerm();
|
|
|
|
+
|
|
|
|
+- return result;
|
|
|
|
++ return NS_FAILED(rv) ? 1 : 0;
|
|
|
|
+ }
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+ #ifdef HAS_DLL_BLOCKLIST
|
|
|
|
+ DllBlocklist_Initialize(gBlocklistInitFlags);
|
|
|
|
+ #endif
|
|
|
|
+
|
|
|
|
+ nsresult rv = InitXPCOMGlue(LibLoadingStrategy::ReadAhead);
|
|
|
|
+diff --git a/suite/components/shell/moz.build b/suite/components/shell/moz.build
|
|
|
|
+--- a/suite/components/shell/moz.build
|
|
|
|
++++ b/suite/components/shell/moz.build
|
|
|
|
+@@ -21,16 +21,19 @@ XPIDL_MODULE = "shellservice"
|
|
|
|
+
|
|
|
|
+ if CONFIG["OS_ARCH"] == "WINNT":
|
|
|
|
+ SOURCES += [
|
|
|
|
+ "nsWindowsShellService.cpp",
|
|
|
|
+ ]
|
|
|
|
+ LOCAL_INCLUDES += [
|
|
|
|
+ "/other-licenses/nsis/Contrib/CityHash/cityhash",
|
|
|
|
+ ]
|
|
|
|
++ OS_LIBS += [
|
|
|
|
++ "propsys",
|
|
|
|
++ ]
|
|
|
|
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
|
|
|
|
+ SOURCES += ["nsMacShellService.cpp"]
|
|
|
|
+ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
|
|
|
+ SOURCES += ["nsGNOMEShellService.cpp"]
|
|
|
|
+
|
|
|
|
+ if SOURCES:
|
|
|
|
+ EXTRA_COMPONENTS += [
|
|
|
|
+ "nsSetDefault.js",
|