diff options
Diffstat (limited to '')
-rw-r--r-- | ipc/app/Makefile.in | 36 | ||||
-rw-r--r-- | ipc/app/MozillaRuntimeMain.cpp | 98 | ||||
-rw-r--r-- | ipc/app/MozillaRuntimeMainAndroid.cpp | 32 | ||||
-rw-r--r-- | ipc/app/macbuild/Contents/Info.plist.in | 32 | ||||
-rw-r--r-- | ipc/app/macbuild/Contents/PkgInfo | 1 | ||||
-rw-r--r-- | ipc/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | 7 | ||||
-rw-r--r-- | ipc/app/module.ver | 6 | ||||
-rw-r--r-- | ipc/app/moz.build | 90 | ||||
-rw-r--r-- | ipc/app/plugin-container.exe.manifest | 53 |
9 files changed, 355 insertions, 0 deletions
diff --git a/ipc/app/Makefile.in b/ipc/app/Makefile.in new file mode 100644 index 0000000000..b55490ff09 --- /dev/null +++ b/ipc/app/Makefile.in @@ -0,0 +1,36 @@ +# 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:: + $(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,-Fsubstitution -DPROGRAM='$(MOZ_CHILD_PROCESS_NAME)' -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,-Fsubstitution --output-encoding utf-16 -DAPP_NAME='$(MOZ_CHILD_PROCESS_BUNDLENAME)' $(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 +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 <dlfcn.h> +#include <android/log.h> + +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..c4a3ebab63 --- /dev/null +++ b/ipc/app/macbuild/Contents/Info.plist.in @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>@PROGRAM@</string> + <key>CFBundleIdentifier</key> + <string>org.mozilla.plugincontainer</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>LSBackgroundOnly</key> + <string>1</string> + <key>NSRequiresAquaSystemAppearance</key> + <true/> + <key>NSSupportsAutomaticGraphicsSwitching</key> + <true/> + <key>NSHighResolutionCapable</key> + <true/> + <key>MozillaDeveloperRepoPath</key> + <string>@MOZ_DEVELOPER_REPO_PATH@</string> + <key>MozillaDeveloperObjPath</key> + <string>@MOZ_DEVELOPER_OBJ_PATH@</string> +</dict> +</plist> 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity + version="1.0.0.0" + processorArchitecture="*" + name="plugin-container" + type="win32" +/> +<description>Firefox Runtime</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="*" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> +</dependency> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="mozglue" + version="1.0.0.0" + language="*" + /> + </dependentAssembly> +</dependency> + <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3"> + <ms_asmv3:security> + <ms_asmv3:requestedPrivileges> + <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" /> + </ms_asmv3:requestedPrivileges> + </ms_asmv3:security> + </ms_asmv3:trustInfo> + <ms_asmv3:application xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3"> + <ms_asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> + <dpiAware>True/PM</dpiAware> + <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness> + </ms_asmv3:windowsSettings> + </ms_asmv3:application> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + </application> + </compatibility> +</assembly> |