Add sandbox support (issue #524).

- The sandbox is now enabled by default on all platforms. Use the CefSettings.no_sandbox option or the "no-sandbox" command-line flag to disable sandbox support.
- Windows: See cef_sandbox_win.h for requirements to enable sandbox support.
- Windows: If Visual Studio isn't installed in the standard location set the CEF_VCVARS environment variable before running make_distrib.py or automate.py (see msvs_env.bat).
- Linux: For binary distributions a new chrome-sandbox executable with SUID permissions must be placed next to the CEF executable. See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for details on setting up the development environment when building CEF from source code.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1518 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2013-11-15 18:47:02 +00:00
parent 395f443215
commit f5bc72b234
24 changed files with 485 additions and 52 deletions

View File

@@ -263,7 +263,7 @@ int main(int argc, char* argv[]) {
CefRefPtr<ClientApp> app(new ClientApp);
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app.get());
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0)
return exit_code;
@@ -286,7 +286,7 @@ int main(int argc, char* argv[]) {
AppGetSettings(settings);
// Initialize CEF.
CefInitialize(main_args, settings, app.get());
CefInitialize(main_args, settings, app.get(), NULL);
// Register the scheme handler.
scheme_test::InitTest();

View File

@@ -468,7 +468,7 @@ int main(int argc, char* argv[]) {
CefRefPtr<ClientApp> app(new ClientApp);
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app.get());
int exit_code = CefExecuteProcess(main_args, app.get(), NULL);
if (exit_code >= 0)
return exit_code;
@@ -490,7 +490,7 @@ int main(int argc, char* argv[]) {
AppGetSettings(settings);
// Initialize CEF.
CefInitialize(main_args, settings, app.get());
CefInitialize(main_args, settings, app.get(), NULL);
// Register the scheme handler.
scheme_test::InitTest();

View File

@@ -13,6 +13,7 @@
#include "include/cef_browser.h"
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "include/cef_sandbox_win.h"
#include "cefclient/cefclient_osr_widget_win.h"
#include "cefclient/client_handler.h"
#include "cefclient/client_switches.h"
@@ -66,11 +67,15 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// Manages the life span of the sandbox information object.
CefScopedSandboxInfo scoped_sandbox;
CefMainArgs main_args(hInstance);
CefRefPtr<ClientApp> app(new ClientApp);
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app.get());
int exit_code = CefExecuteProcess(main_args, app.get(),
scoped_sandbox.sandbox_info());
if (exit_code >= 0)
return exit_code;
@@ -87,7 +92,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
AppGetSettings(settings);
// Initialize CEF.
CefInitialize(main_args, settings, app.get());
CefInitialize(main_args, settings, app.get(), scoped_sandbox.sandbox_info());
// Register the scheme handler.
scheme_test::InitTest();

View File

@@ -28,5 +28,5 @@ int main(int argc, char* argv[]) {
CefRefPtr<CefApp> app(new ClientApp);
// Execute the secondary process.
return CefExecuteProcess(main_args, app);
return CefExecuteProcess(main_args, app, NULL);
}

View File

@@ -14,6 +14,10 @@
// Include after base/bind.h to avoid name collisions with cef_tuple.h.
#include "include/cef_runnable.h"
#if defined(OS_WIN)
#include "include/cef_sandbox_win.h"
#endif
namespace {
// Thread used to run the test suite.
@@ -60,10 +64,18 @@ int main(int argc, char* argv[]) {
CefMainArgs main_args(argc, argv);
#endif
void* windows_sandbox_info = NULL;
#if defined(OS_WIN)
// Manages the life span of the sandbox information object.
CefScopedSandboxInfo scoped_sandbox;
windows_sandbox_info = scoped_sandbox.sandbox_info();
#endif
CefRefPtr<CefApp> app(new ClientApp);
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, app);
int exit_code = CefExecuteProcess(main_args, app, windows_sandbox_info);
if (exit_code >= 0)
return exit_code;
@@ -80,7 +92,7 @@ int main(int argc, char* argv[]) {
#endif
// Initialize CEF.
CefInitialize(main_args, settings, app);
CefInitialize(main_args, settings, app, windows_sandbox_info);
// Create the test suite object.
CefTestSuite test_suite(argc, argv);