ipc/contentproc/plugin-container.cpp
author J.C. Jones <jjones@mozilla.com>
Wed, 23 May 2018 14:09:30 -0700
changeset 473420 4fa86932be2d7a90b2494de9ae6c379c86a031f9
parent 460185 b539afa21a7cefc0b5a2665c1e41afa00f2d20b2
child 508163 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1463539 - Land NSS NSS_3_37_1_RTM UPGRADE_NSS_RELEASE. r=me, a=RyanVM

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: sw=4 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"
#else
// FIXME/cjones testing
#include <unistd.h>
#endif

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

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 =
            mozilla::sandboxing::GetInitializedTargetServices();
        if (!childData.sandboxTargetServices) {
            return 1;
        }

        childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
    }
#endif

    bootstrap->XRE_SetProcessType(argv[--argc]);

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