1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "RDDProcessImpl.h"
8 #include "mozilla/ipc/IOThreadChild.h"
9 #include "mozilla/GeckoArgs.h"
11 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
12 # include "mozilla/sandboxTarget.h"
13 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
14 # include "mozilla/SandboxSettings.h"
22 RDDProcessImpl::~RDDProcessImpl() = default;
24 bool RDDProcessImpl::Init(int aArgc
, char* aArgv
[]) {
25 #if defined(MOZ_SANDBOX) && defined(XP_WIN)
26 // Preload AV dlls so we can enable Binary Signature Policy
27 // to restrict further dll loads.
28 LoadLibraryW(L
"mozavcodec.dll");
29 LoadLibraryW(L
"mozavutil.dll");
30 mozilla::SandboxTarget::Instance()->StartSandbox();
31 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
32 PR_LoadLibrary("libmozavcodec.so");
33 PR_LoadLibrary("libmozavutil.so");
34 PR_LoadLibrary("libavcodec.so");
35 StartOpenBSDSandbox(GeckoProcessType_RDD
);
37 Maybe
<const char*> parentBuildID
=
38 geckoargs::sParentBuildID
.Get(aArgc
, aArgv
);
39 if (parentBuildID
.isNothing()) {
43 if (!ProcessChild::InitPrefs(aArgc
, aArgv
)) {
47 return mRDD
->Init(TakeInitialEndpoint(), *parentBuildID
);
50 void RDDProcessImpl::CleanUp() { NS_ShutdownXPCOM(nullptr); }
52 } // namespace mozilla