2014-04-03 15:58:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* 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/. */
|
1999-04-10 10:51:01 +04:00
|
|
|
|
|
|
|
/* XPConnect JavaScript interactive shell. */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2011-10-11 10:00:28 +04:00
|
|
|
|
2013-11-12 17:31:32 +04:00
|
|
|
#include "mozilla/WindowsDllBlocklist.h"
|
2016-12-16 05:10:02 +03:00
|
|
|
#include "mozilla/Bootstrap.h"
|
2011-10-11 10:00:28 +04:00
|
|
|
|
2009-01-20 22:56:44 +03:00
|
|
|
#include "nsXULAppAPI.h"
|
2008-06-03 14:56:09 +04:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
#include "xpcshellMacUtils.h"
|
|
|
|
#endif
|
2009-01-18 20:01:15 +03:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#include <windows.h>
|
2012-05-22 18:50:04 +04:00
|
|
|
#include <shlobj.h>
|
2012-09-30 20:45:05 +04:00
|
|
|
|
|
|
|
// we want a wmain entry point
|
|
|
|
#define XRE_DONT_PROTECT_DLL_LOAD
|
|
|
|
#define XRE_WANT_ENVIRON
|
|
|
|
#include "nsWindowsWMain.cpp"
|
2016-05-15 18:41:40 +03:00
|
|
|
#ifdef MOZ_SANDBOX
|
|
|
|
#include "mozilla/sandboxing/SandboxInitialization.h"
|
|
|
|
#endif
|
2009-01-18 20:01:15 +03:00
|
|
|
#endif
|
1999-04-10 10:51:01 +04:00
|
|
|
|
2015-07-29 23:38:28 +03:00
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#endif
|
|
|
|
|
1999-04-10 10:51:01 +04:00
|
|
|
int
|
2013-10-01 00:09:28 +04:00
|
|
|
main(int argc, char** argv, char** envp)
|
1999-04-10 10:51:01 +04:00
|
|
|
{
|
2015-07-29 23:38:28 +03:00
|
|
|
#ifdef MOZ_WIDGET_GTK
|
|
|
|
// A default display may or may not be required for xpcshell tests, and so
|
|
|
|
// is not created here. Instead we set the command line args, which is a
|
|
|
|
// fairly cheap operation.
|
|
|
|
gtk_parse_args(&argc, &argv);
|
|
|
|
#endif
|
|
|
|
|
2008-06-03 14:56:09 +04:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
InitAutoreleasePool();
|
|
|
|
#endif
|
1999-04-10 10:51:01 +04:00
|
|
|
|
2007-02-14 00:16:09 +03:00
|
|
|
// unbuffer stdout so that output is in the correct order; note that stderr
|
|
|
|
// is unbuffered by default
|
|
|
|
setbuf(stdout, 0);
|
|
|
|
|
2013-11-12 17:31:32 +04:00
|
|
|
#ifdef HAS_DLL_BLOCKLIST
|
|
|
|
DllBlocklist_Initialize();
|
2012-02-23 03:05:28 +04:00
|
|
|
#endif
|
|
|
|
|
2016-05-15 18:41:40 +03:00
|
|
|
XREShellData shellData;
|
|
|
|
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
|
|
|
shellData.sandboxBrokerServices =
|
|
|
|
mozilla::sandboxing::GetInitializedBrokerServices();
|
|
|
|
#endif
|
|
|
|
|
2016-12-16 05:10:02 +03:00
|
|
|
mozilla::Bootstrap::UniquePtr bootstrap;
|
|
|
|
XRE_GetBootstrap(bootstrap);
|
|
|
|
if (!bootstrap) {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
int result = bootstrap->XRE_XPCShellMain(argc, argv, envp, &shellData);
|
2009-01-20 22:56:44 +03:00
|
|
|
|
2008-06-03 14:56:09 +04:00
|
|
|
#ifdef XP_MACOSX
|
|
|
|
FinishAutoreleasePool();
|
|
|
|
#endif
|
|
|
|
|
1999-04-10 10:51:01 +04:00
|
|
|
return result;
|
|
|
|
}
|