LCOV - code coverage report
Current view: top level - ipc/contentproc - plugin-container.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 4 6 66.7 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: sw=4 ts=4 et :
       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             : 
       7             : #include "nsXPCOM.h"
       8             : #include "nsXULAppAPI.h"
       9             : #include "nsAutoPtr.h"
      10             : #include "mozilla/Bootstrap.h"
      11             : 
      12             : #ifdef XP_WIN
      13             : #include <windows.h>
      14             : // we want a wmain entry point
      15             : // but we don't want its DLL load protection, because we'll handle it here
      16             : #define XRE_DONT_PROTECT_DLL_LOAD
      17             : #include "nsWindowsWMain.cpp"
      18             : #include "nsSetDllDirectory.h"
      19             : #else
      20             : // FIXME/cjones testing
      21             : #include <unistd.h>
      22             : #endif
      23             : 
      24             : #if defined(XP_WIN) && defined(MOZ_SANDBOX)
      25             : #include "mozilla/sandboxing/SandboxInitialization.h"
      26             : #include "mozilla/sandboxing/sandboxLogging.h"
      27             : #endif
      28             : 
      29             : int
      30           2 : content_process_main(mozilla::Bootstrap* bootstrap, int argc, char* argv[])
      31             : {
      32             :     // Check for the absolute minimum number of args we need to move
      33             :     // forward here. We expect the last arg to be the child process type.
      34           2 :     if (argc < 1) {
      35           0 :       return 3;
      36             :     }
      37             : 
      38             :     XREChildData childData;
      39             : 
      40             : #if defined(XP_WIN) && defined(MOZ_SANDBOX)
      41             :     if (IsSandboxedProcess()) {
      42             :         childData.sandboxTargetServices =
      43             :             mozilla::sandboxing::GetInitializedTargetServices();
      44             :         if (!childData.sandboxTargetServices) {
      45             :             return 1;
      46             :         }
      47             : 
      48             :         childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
      49             :     }
      50             : #endif
      51             : 
      52           2 :     bootstrap->XRE_SetProcessType(argv[--argc]);
      53             : 
      54             : #ifdef XP_WIN
      55             :     // For plugins, this is done in PluginProcessChild::Init, as we need to
      56             :     // avoid it for unsupported plugins.  See PluginProcessChild::Init for
      57             :     // the details.
      58             :     if (bootstrap->XRE_GetProcessType() != GeckoProcessType_Plugin) {
      59             :         mozilla::SanitizeEnvironmentVariables();
      60             :         SetDllDirectoryW(L"");
      61             :     }
      62             : #endif
      63             : 
      64           2 :     nsresult rv = bootstrap->XRE_InitChildProcess(argc, argv, &childData);
      65           0 :     return NS_FAILED(rv);
      66             : }

Generated by: LCOV version 1.13