2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2018-11-30 18:39:55 +03:00
|
|
|
* vim: sw=2 ts=4 et :
|
2014-07-30 11:24:00 +04:00
|
|
|
* 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
|
|
|
|
|
2016-12-16 05:10:02 +03:00
|
|
|
int content_process_main(mozilla::Bootstrap* bootstrap, int argc,
|
|
|
|
char* argv[]) {
|
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;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-05-15 18:35:22 +03:00
|
|
|
childData.ProvideLogFunction = mozilla::sandboxing::ProvideLogFunction;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
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
|
|
|
}
|