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:
parent
c783ec72bc
commit
1d228446db
2 changed files with 9 additions and 2 deletions
|
@ -122,8 +122,14 @@ void AtomMainDelegate::PreSandboxStartup() {
|
||||||
if (!IsBrowserProcess(command_line))
|
if (!IsBrowserProcess(command_line))
|
||||||
return;
|
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.
|
// Disable renderer sandbox for most of node's functions.
|
||||||
command_line->AppendSwitch(::switches::kNoSandbox);
|
command_line->AppendSwitch(::switches::kNoSandbox);
|
||||||
|
}
|
||||||
|
|
||||||
// Allow file:// URIs to read other file:// URIs by default.
|
// Allow file:// URIs to read other file:// URIs by default.
|
||||||
command_line->AppendSwitch(::switches::kAllowFileAccessFromFiles);
|
command_line->AppendSwitch(::switches::kAllowFileAccessFromFiles);
|
||||||
|
|
|
@ -232,6 +232,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
|
||||||
// Copy following switches to child process.
|
// Copy following switches to child process.
|
||||||
static const char* const kCommonSwitchNames[] = {
|
static const char* const kCommonSwitchNames[] = {
|
||||||
switches::kStandardSchemes,
|
switches::kStandardSchemes,
|
||||||
|
switches::kEnableSandbox
|
||||||
};
|
};
|
||||||
command_line->CopySwitchesFrom(
|
command_line->CopySwitchesFrom(
|
||||||
*base::CommandLine::ForCurrentProcess(),
|
*base::CommandLine::ForCurrentProcess(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue