Expose --enable-sandbox command-line switch.

When `--enable-sandbox` is passed, electron will use chromium sandbox to spawn
all renderers, and every new BrowserWindow will automatically have "sandboxed"
passed as a web preference(since the renderer would not work properly
otherwise).
This commit is contained in:
Thiago de Arruda 2016-08-15 08:01:24 -03:00
parent c783ec72bc
commit 1d228446db
2 changed files with 9 additions and 2 deletions

View file

@ -122,8 +122,14 @@ void AtomMainDelegate::PreSandboxStartup() {
if (!IsBrowserProcess(command_line))
return;
if (command_line->HasSwitch(switches::kEnableSandbox)) {
// Disable setuid sandbox since it is not longer required on linux(namespace
// sandbox is available on most distros).
command_line->AppendSwitch(::switches::kDisableSetuidSandbox);
} else {
// Disable renderer sandbox for most of node's functions.
command_line->AppendSwitch(::switches::kNoSandbox);
}
// Allow file:// URIs to read other file:// URIs by default.
command_line->AppendSwitch(::switches::kAllowFileAccessFromFiles);

View file

@ -232,6 +232,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
// Copy following switches to child process.
static const char* const kCommonSwitchNames[] = {
switches::kStandardSchemes,
switches::kEnableSandbox
};
command_line->CopySwitchesFrom(
*base::CommandLine::ForCurrentProcess(),