From: Cheng Zhao Date: Sat, 20 Apr 2013 03:19:25 +0000 (+0800) Subject: Disable renderer sandbox. X-Git-Tag: v0.1.0~286 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=34c4d734af9f28ec51c4e3b259863519713e408b;p=electron.git Disable renderer sandbox. --- diff --git a/app/atom_main_delegate.cc b/app/atom_main_delegate.cc index 3bf42499..0867aa9b 100644 --- a/app/atom_main_delegate.cc +++ b/app/atom_main_delegate.cc @@ -4,7 +4,9 @@ #include "app/atom_main_delegate.h" +#include "base/command_line.h" #include "browser/atom_browser_client.h" +#include "content/public/common/content_switches.h" #include "renderer/atom_renderer_client.h" namespace atom { @@ -15,6 +17,14 @@ AtomMainDelegate::AtomMainDelegate() { AtomMainDelegate::~AtomMainDelegate() { } +void AtomMainDelegate::PreSandboxStartup() { + brightray::MainDelegate::PreSandboxStartup(); + + // Disable renderer sandbox for most of node's functions. + CommandLine* command_line = CommandLine::ForCurrentProcess(); + command_line->AppendSwitch(switches::kNoSandbox); +} + content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() { browser_client_.reset(new AtomBrowserClient); return browser_client_.get(); diff --git a/app/atom_main_delegate.h b/app/atom_main_delegate.h index 7ca79325..2ff8af6a 100644 --- a/app/atom_main_delegate.h +++ b/app/atom_main_delegate.h @@ -14,6 +14,9 @@ class AtomMainDelegate : public brightray::MainDelegate { AtomMainDelegate(); ~AtomMainDelegate(); +protected: + virtual void PreSandboxStartup() OVERRIDE; + private: virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; virtual content::ContentRendererClient*