From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- ipc/app/Makefile.in | 44 ++++++++++ ipc/app/MozillaRuntimeMain.cpp | 98 ++++++++++++++++++++++ ipc/app/MozillaRuntimeMainAndroid.cpp | 32 +++++++ ipc/app/macbuild/Contents/Info.plist.in | 32 +++++++ ipc/app/macbuild/Contents/PkgInfo | 1 + .../Resources/English.lproj/InfoPlist.strings.in | 7 ++ ipc/app/module.ver | 6 ++ ipc/app/moz.build | 90 ++++++++++++++++++++ ipc/app/plugin-container.exe.manifest | 53 ++++++++++++ 9 files changed, 363 insertions(+) create mode 100644 ipc/app/Makefile.in create mode 100644 ipc/app/MozillaRuntimeMain.cpp create mode 100644 ipc/app/MozillaRuntimeMainAndroid.cpp create mode 100644 ipc/app/macbuild/Contents/Info.plist.in create mode 100644 ipc/app/macbuild/Contents/PkgInfo create mode 100644 ipc/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in create mode 100644 ipc/app/module.ver create mode 100644 ipc/app/moz.build create mode 100644 ipc/app/plugin-container.exe.manifest (limited to 'ipc/app') diff --git a/ipc/app/Makefile.in b/ipc/app/Makefile.in new file mode 100644 index 0000000000..b7f40e9fb5 --- /dev/null +++ b/ipc/app/Makefile.in @@ -0,0 +1,44 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +ifndef MOZ_WINCONSOLE +ifdef MOZ_DEBUG +MOZ_WINCONSOLE = 1 +else +MOZ_WINCONSOLE = 0 +endif +endif + +include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk + +ifneq ($(MOZ_WIDGET_TOOLKIT),android) +#LIBS += ../contentproc/$(LIB_PREFIX)plugin-container.$(LIB_SUFFIX) +endif + +ifeq ($(OS_ARCH),WINNT) #{ +# Note the manifest file exists in the tree, so we use the explicit filename +# here. +EXTRA_DEPS += plugin-container.exe.manifest +endif #} + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{ + +libs:: + # plugin-container + $(NSINSTALL) -D $(DIST)/bin/$(PROGRAM).app + rsync -a -C --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app + $(call py_action,preprocessor $(MOZ_CHILD_PROCESS_NAME).app/Contents/Info.plist,-Fsubstitution -DEXECUTABLE='$(MOZ_CHILD_PROCESS_NAME)' -DBUNDLEID='$(MOZ_CHILD_PROCESS_BUNDLEID)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Info.plist) + $(call py_action,preprocessor $(MOZ_CHILD_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_CHILD_PROCESS_APPNAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings) + $(NSINSTALL) -D $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/MacOS + $(NSINSTALL) $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME) $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME).app/Contents/MacOS + # media-plugin-helper + $(NSINSTALL) -D $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app + rsync -a -C --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app + $(call py_action,preprocessor $(MOZ_EME_PROCESS_NAME).app/Contents/Info.plist,-Fsubstitution -DEXECUTABLE='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DBUNDLEID='$(MOZ_EME_PROCESS_BUNDLEID)' -DMOZ_EME_PROCESS_NAME_BRANDED='$(MOZ_EME_PROCESS_NAME_BRANDED)' -DMOZ_DEVELOPER_REPO_PATH='$(topsrcdir)' -DMOZ_DEVELOPER_OBJ_PATH='$(topobjdir)' $(srcdir)/macbuild/Contents/Info.plist.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Info.plist) + $(call py_action,preprocessor $(MOZ_EME_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_EME_PROCESS_BUNDLENAME)' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in -o $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/Resources/English.lproj/InfoPlist.strings) + $(NSINSTALL) -D $(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/MacOS + cp $(DIST)/bin/$(MOZ_CHILD_PROCESS_NAME) "$(DIST)/bin/$(MOZ_EME_PROCESS_NAME).app/Contents/MacOS/$(MOZ_EME_PROCESS_NAME_BRANDED)" +endif #} diff --git a/ipc/app/MozillaRuntimeMain.cpp b/ipc/app/MozillaRuntimeMain.cpp new file mode 100644 index 0000000000..6741617b60 --- /dev/null +++ b/ipc/app/MozillaRuntimeMain.cpp @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "../contentproc/plugin-container.cpp" + +#include "mozilla/Bootstrap.h" +#include "mozilla/RuntimeExceptionModule.h" +#include "mozilla/ScopeExit.h" +#if defined(XP_WIN) +# include "mozilla/WindowsDllBlocklist.h" +# include "mozilla/GeckoArgs.h" +#endif // defined(XP_WIN) + +using namespace mozilla; + +static bool UseForkServer(int argc, char* argv[]) { +#if defined(MOZ_ENABLE_FORKSERVER) + return strcmp(argv[argc - 1], "forkserver") == 0; +#else + return false; +#endif +} + +static int RunForkServer(Bootstrap::UniquePtr&& bootstrap, int argc, + char* argv[]) { +#if defined(MOZ_ENABLE_FORKSERVER) + int ret = 0; + + bootstrap->NS_LogInit(); + + // Run a fork server in this process, single thread. When it + // returns, it means the fork server have been stopped or a new + // content process is created. + // + // For the later case, XRE_ForkServer() will return false, running + // in a content process just forked from the fork server process. + // argc & argv will be updated with the values passing from the + // chrome process. With the new values, this function + // continues the reset of the code acting as a content process. + if (bootstrap->XRE_ForkServer(&argc, &argv)) { + // Return from the fork server in the fork server process. + // Stop the fork server. + } else { + // In a content process forked from the fork server. + // Start acting as a content process. + ret = content_process_main(bootstrap.get(), argc, argv); + } + + bootstrap->NS_LogTerm(); + return ret; +#else + return 0; +#endif +} + +int main(int argc, char* argv[]) { + auto bootstrapResult = GetBootstrap(); + if (bootstrapResult.isErr()) { + return 2; + } + + Bootstrap::UniquePtr bootstrap = bootstrapResult.unwrap(); + + int ret; + if (UseForkServer(argc, argv)) { + ret = RunForkServer(std::move(bootstrap), argc, argv); + } else { + // Set the process type. We don't remove the arg here as that will be done + // later in common code. + SetGeckoProcessType(argv[argc - 1]); + + // Register an external module to report on otherwise uncatchable + // exceptions. Note that in child processes this must be called after Gecko + // process type has been set. + CrashReporter::RegisterRuntimeExceptionModule(); + + // Make sure we unregister the runtime exception module before returning. + auto unregisterRuntimeExceptionModule = MakeScopeExit( + [] { CrashReporter::UnregisterRuntimeExceptionModule(); }); + +#ifdef HAS_DLL_BLOCKLIST + uint32_t initFlags = eDllBlocklistInitFlagIsChildProcess; + SetDllBlocklistProcessTypeFlags(initFlags, GetGeckoProcessType()); + DllBlocklist_Initialize(initFlags); +#endif + + ret = content_process_main(bootstrap.get(), argc, argv); + +#if defined(DEBUG) && defined(HAS_DLL_BLOCKLIST) + DllBlocklist_Shutdown(); +#endif + } + + return ret; +} diff --git a/ipc/app/MozillaRuntimeMainAndroid.cpp b/ipc/app/MozillaRuntimeMainAndroid.cpp new file mode 100644 index 0000000000..b70015018d --- /dev/null +++ b/ipc/app/MozillaRuntimeMainAndroid.cpp @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * vim: sw=2 ts=4 et : + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include +#include + +int main(int argc, char* argv[]) { + // Check for the absolute minimum number of args we need to move + // forward here. We expect the last arg to be the child process type. + if (argc < 2) return 1; + + void* mozloader_handle = dlopen("libmozglue.so", RTLD_LAZY); + if (!mozloader_handle) { + __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad", + "Couldn't load mozloader because %s", dlerror()); + return 1; + } + + typedef int (*ChildProcessInit_t)(int, char**); + ChildProcessInit_t fChildProcessInit = + (ChildProcessInit_t)dlsym(mozloader_handle, "ChildProcessInit"); + if (!fChildProcessInit) { + __android_log_print(ANDROID_LOG_ERROR, "GeckoChildLoad", + "Couldn't load cpi_t because %s", dlerror()); + return 1; + } + + return fChildProcessInit(argc, argv); +} diff --git a/ipc/app/macbuild/Contents/Info.plist.in b/ipc/app/macbuild/Contents/Info.plist.in new file mode 100644 index 0000000000..0908849949 --- /dev/null +++ b/ipc/app/macbuild/Contents/Info.plist.in @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + @EXECUTABLE@ + CFBundleIdentifier + @BUNDLEID@ + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSBackgroundOnly + 1 + NSRequiresAquaSystemAppearance + + NSSupportsAutomaticGraphicsSwitching + + NSHighResolutionCapable + + MozillaDeveloperRepoPath + @MOZ_DEVELOPER_REPO_PATH@ + MozillaDeveloperObjPath + @MOZ_DEVELOPER_OBJ_PATH@ + + diff --git a/ipc/app/macbuild/Contents/PkgInfo b/ipc/app/macbuild/Contents/PkgInfo new file mode 100644 index 0000000000..bd04210fb4 --- /dev/null +++ b/ipc/app/macbuild/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/ipc/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in b/ipc/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in new file mode 100644 index 0000000000..55d15cad8a --- /dev/null +++ b/ipc/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* Localized versions of Info.plist keys */ + +CFBundleName = "@APP_NAME@"; diff --git a/ipc/app/module.ver b/ipc/app/module.ver new file mode 100644 index 0000000000..8abbd23f0e --- /dev/null +++ b/ipc/app/module.ver @@ -0,0 +1,6 @@ +WIN32_MODULE_COMPANYNAME=Mozilla Corporation +WIN32_MODULE_PRODUCTVERSION=@MOZ_APP_WINVERSION@ +WIN32_MODULE_PRODUCTVERSION_STRING=@MOZ_APP_VERSION@ +WIN32_MODULE_DESCRIPTION=Plugin Container for @MOZ_APP_DISPLAYNAME@ +WIN32_MODULE_PRODUCTNAME=@MOZ_APP_DISPLAYNAME@ +WIN32_MODULE_NAME=@MOZ_APP_DISPLAYNAME@ diff --git a/ipc/app/moz.build b/ipc/app/moz.build new file mode 100644 index 0000000000..afe1df122b --- /dev/null +++ b/ipc/app/moz.build @@ -0,0 +1,90 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + Program(CONFIG["MOZ_CHILD_PROCESS_NAME"]) + SOURCES += [ + "MozillaRuntimeMainAndroid.cpp", + ] +else: + GeckoProgram(CONFIG["MOZ_CHILD_PROCESS_NAME"], linkage="dependent") + + SOURCES += [ + "MozillaRuntimeMain.cpp", + ] + +include("/ipc/chromium/chromium-config.mozbuild") + +LOCAL_INCLUDES += [ + "/toolkit/xre", + "/xpcom/base", +] + +# DELAYLOAD_DLLS in this block ensures that the DLL blocklist is functional +if CONFIG["OS_ARCH"] == "WINNT": + DELAYLOAD_DLLS += [ + "nss3.dll", + ] + + if CONFIG["MOZ_SANDBOX"]: + # For sandbox includes and the include dependencies those have + LOCAL_INCLUDES += [ + "/security/sandbox/chromium", + "/security/sandbox/chromium-shim", + ] + + OS_LIBS += [ + "advapi32", + "user32", + "version", + "winmm", + ] + + USE_LIBS += [ + "sandbox_s", + ] + + DELAYLOAD_DLLS += [ + "winmm.dll", + "user32.dll", + ] + + OS_LIBS += [ + "ntdll", + ] + + DELAYLOAD_DLLS += [ + "xul.dll", + ] + + # Don't build plugin-container.exe with CETCOMPAT for the moment, so that + # we can enable it using a pref during testing. + LINK_FLAGS["CETCOMPAT"] = [] + +if CONFIG["OS_ARCH"] == "Darwin": + LDFLAGS += ["-Wl,-rpath,@executable_path/../../../"] + +if CONFIG["CC_TYPE"] == "clang-cl": + # Always enter a Windows program through wmain, whether or not we're + # a console application. + WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"] + +# Control the default heap size. +# This is the heap returned by GetProcessHeap(). +# As we use the CRT heap, the default size is too large and wastes VM. +# +# The default heap size is 1MB on Win32. +# The heap will grow if need be. +# +# Set it to 256k. See bug 127069. +if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"): + LDFLAGS += ["/HEAP:0x40000"] + +if CONFIG["CC_TYPE"] in ("clang", "gcc"): + CXXFLAGS += ["-Wshadow"] + +with Files("**"): + BUG_COMPONENT = ("Core", "DOM: Content Processes") diff --git a/ipc/app/plugin-container.exe.manifest b/ipc/app/plugin-container.exe.manifest new file mode 100644 index 0000000000..3ccedc20c2 --- /dev/null +++ b/ipc/app/plugin-container.exe.manifest @@ -0,0 +1,53 @@ + + + +Firefox Runtime + + + + + + + + + + + + + + + + + + + + True/PM + PerMonitorV2,PerMonitor + + + + + + + + + + + -- cgit v1.2.3