tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RDDProcessImpl.cpp (1576B)


      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"
      7 
      8 #include "mozilla/GeckoArgs.h"
      9 
     10 #if defined(XP_WIN) && defined(MOZ_SANDBOX)
     11 #  include "mozilla/sandboxTarget.h"
     12 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
     13 #  include "mozilla/SandboxSettings.h"
     14 #  include "prlink.h"
     15 #endif
     16 
     17 namespace mozilla {
     18 
     19 using namespace ipc;
     20 
     21 RDDProcessImpl::~RDDProcessImpl() = default;
     22 
     23 bool RDDProcessImpl::Init(int aArgc, char* aArgv[]) {
     24 #if defined(MOZ_SANDBOX) && defined(XP_WIN)
     25  // Preload AV dlls so we can enable Binary Signature Policy
     26  // to restrict further dll loads.
     27  LoadLibraryW(L"mozavcodec.dll");
     28  LoadLibraryW(L"mozavutil.dll");
     29  mozilla::SandboxTarget::Instance()->StartSandbox();
     30 #elif defined(__OpenBSD__) && defined(MOZ_SANDBOX)
     31  PR_LoadLibrary("libmozavcodec.so");
     32  PR_LoadLibrary("libmozavutil.so");
     33  PR_LoadLibrary("libavcodec.so");
     34  StartOpenBSDSandbox(GeckoProcessType_RDD);
     35 #endif
     36  Maybe<const char*> parentBuildID =
     37      geckoargs::sParentBuildID.Get(aArgc, aArgv);
     38  if (parentBuildID.isNothing()) {
     39    return false;
     40  }
     41 
     42  if (!ProcessChild::InitPrefs(aArgc, aArgv)) {
     43    return false;
     44  }
     45 
     46  return mRDD->Init(TakeInitialEndpoint(), *parentBuildID);
     47 }
     48 
     49 void RDDProcessImpl::CleanUp() { NS_ShutdownXPCOM(nullptr); }
     50 
     51 }  // namespace mozilla