2014-07-30 11:24:00 +04:00
|
|
|
/* -*- 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"
|
2016-12-16 05:10:02 +03:00
|
|
|
#include "mozilla/Bootstrap.h"
|
2014-07-30 11:24:00 +04:00
|
|
|
|
|
|
|
#ifdef XP_WIN
|
|
|
|
#include <windows.h>
|
|
|
|
// we want a wmain entry point
|
|
|
|
#include "nsWindowsWMain.cpp"
|
2016-06-03 22:49:39 +03:00
|
|
|
#else
|
|
|
|
// FIXME/cjones testing
|
|
|
|
#include <unistd.h>
|
2014-07-30 11:24:00 +04:00
|
|
|
#endif
|
|
|
|
|
2014-08-27 18:32:55 +04:00
|
|
|
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
2016-05-15 18:35:22 +03:00
|
|
|
#include "mozilla/sandboxing/SandboxInitialization.h"
|
|
|
|
#include "mozilla/sandboxing/sandboxLogging.h"
|
2014-07-30 11:24:00 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
int
|
2016-12-16 05:10:02 +03:00
|
|
|
content_process_main(mozilla::Bootstrap* bootstrap, int argc, char* argv[])
|
2014-07-30 11:24:00 +04:00
|
|
|
{
|
2014-08-09 04:52:12 +04:00
|
|
|
// 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.
|
2014-08-09 04:55:22 +04:00
|
|
|
if (argc < 1) {
|
2014-08-09 04:52:12 +04:00
|
|
|
return 3;
|
2014-08-09 04:55:22 +04:00
|
|
|
}
|
2014-08-09 04:52:12 +04:00
|
|
|
|
2016-05-15 18:35:22 +03:00
|
|
|
XREChildData childData;
|
|
|
|
|
2015-07-30 12:04:42 +03:00
|
|
|
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
2016-06-07 16:03:51 +03:00
|
|
|
if (IsSandboxedProcess()) {
|
2016-05-15 18:35:22 +03:00
|
|
|
childData.sandboxTargetServices =
|
|
|
|
mozilla::sandboxing::GetInitializedTargetServices();
|
|
|
|
if (!childData.sandboxTargetServices) {
|
2015-07-30 12:04:42 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2016-05-15 18:35:22 +03:00
|
|
|
childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
|
2015-07-30 12:04:42 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-12-16 05:10:02 +03:00
|
|
|
bootstrap->XRE_SetProcessType(argv[--argc]);
|
2015-07-30 12:04:42 +03:00
|
|
|
|
2016-12-16 05:10:02 +03:00
|
|
|
nsresult rv = bootstrap->XRE_InitChildProcess(argc, argv, &childData);
|
2017-01-10 11:50:04 +03:00
|
|
|
return NS_FAILED(rv);
|
2014-07-30 11:24:00 +04:00
|
|
|
}
|