Backed out changeset 0fedfd441a06 (bug 1256992) for gtest failures

This commit is contained in:
Carsten "Tomcat" Book 2016-03-22 09:54:55 +01:00
parent 013a53e651
commit 417d5d9533
4 changed files with 13 additions and 52 deletions

View File

@ -44,9 +44,6 @@
#ifdef XP_WIN
#include "mozilla/widget/AudioSession.h"
#include <windows.h>
#if defined(MOZ_SANDBOX)
#include "SandboxBroker.h"
#endif
#endif
// all this crap is needed to do the interactive shell stuff
@ -1521,14 +1518,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp)
// Plugin may require audio session if installed plugin can initialize
// asynchronized.
AutoAudioSession audioSession;
#if defined(MOZ_SANDBOX)
// Required for sandboxed child processes.
if (!SandboxBroker::Initialize()) {
NS_WARNING("Failed to initialize broker services, sandboxed "
"processes will fail to start.");
}
#endif
#endif
{

View File

@ -17,28 +17,21 @@ namespace mozilla
sandbox::BrokerServices *SandboxBroker::sBrokerService = nullptr;
/* static */
bool
SandboxBroker::Initialize()
{
sBrokerService = sandbox::SandboxFactory::GetBrokerServices();
if (!sBrokerService) {
return false;
}
if (sBrokerService->Init() != sandbox::SBOX_ALL_OK) {
sBrokerService = nullptr;
return false;
}
return true;
}
SandboxBroker::SandboxBroker()
{
if (sBrokerService) {
mPolicy = sBrokerService->CreatePolicy();
// XXX: This is not thread-safe! Two threads could simultaneously try
// to set `sBrokerService`
if (!sBrokerService) {
sBrokerService = sandbox::SandboxFactory::GetBrokerServices();
if (sBrokerService) {
sandbox::ResultCode result = sBrokerService->Init();
if (result != sandbox::SBOX_ALL_OK) {
sBrokerService = nullptr;
}
}
}
mPolicy = sBrokerService->CreatePolicy();
}
bool

View File

@ -27,9 +27,6 @@ class SANDBOX_EXPORT SandboxBroker
{
public:
SandboxBroker();
static bool Initialize();
bool LaunchApp(const wchar_t *aPath,
const wchar_t *aArguments,
const bool aEnableLogging,

View File

@ -211,12 +211,8 @@
#include "AndroidBridge.h"
#endif
#if defined(MOZ_SANDBOX)
#if defined(XP_LINUX) && !defined(ANDROID)
#if defined(MOZ_SANDBOX) && defined(XP_LINUX) && !defined(ANDROID)
#include "mozilla/SandboxInfo.h"
#elif defined(XP_WIN)
#include "SandboxBroker.h"
#endif
#endif
extern uint32_t gRestartMode;
@ -4315,20 +4311,6 @@ XREMain::XRE_mainRun()
}
#endif /* MOZ_INSTRUMENT_EVENT_LOOP */
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
if (!SandboxBroker::Initialize()) {
#if defined(MOZ_CONTENT_SANDBOX)
// If we're sandboxing content and we fail to initialize, then crashing here
// seems like the sensible option.
if (BrowserTabsRemoteAutostart()) {
MOZ_CRASH("Failed to initialize broker services, can't continue.");
}
#endif
// Otherwise just warn for the moment, as most things will work.
NS_WARNING("Failed to initialize broker services, sandboxed processes will "
"fail to start.");
}
#endif
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
SetUpSandboxEnvironment();
#endif