author Nathan Froyd <froydnj@mozilla.com>
Thu, 10 Jan 2019 10:52:51 -0500
changeset 453268 1abd03bcbfa3520c8c0263606c792183ddaa073d
parent 449035 66eb1f485c1a3ea81372758bc92292c9428b17cd
child 454520 5f4630838d46dd81dadb13220a4af0da9e23a619
permissions -rw-r--r--
Bug 1514044 - part 1 - macro-ify process enums, strings, and XRE functions; r=mccr8 Having this information all defined in a single header will make life easier if we ever add new process types.

/* -*- 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 "nsXPCOM.h"
#include "nsXULAppAPI.h"
#include "mozilla/Bootstrap.h"

#ifdef XP_WIN
#include <windows.h>
// we want a wmain entry point
#include "nsWindowsWMain.cpp"
// FIXME/cjones testing
#include <unistd.h>

#if defined(XP_WIN) && defined(MOZ_SANDBOX)
#include "mozilla/sandboxing/SandboxInitialization.h"
#include "mozilla/sandboxing/sandboxLogging.h"

int content_process_main(mozilla::Bootstrap* bootstrap, 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 < 1) {
    return 3;

  XREChildData childData;

#if defined(XP_WIN) && defined(MOZ_SANDBOX)
  if (IsSandboxedProcess()) {
    childData.sandboxTargetServices =
    if (!childData.sandboxTargetServices) {
      return 1;

    childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;


  nsresult rv = bootstrap->XRE_InitChildProcess(argc, argv, &childData);
  return NS_FAILED(rv);