]> khamidou — GitHub mirrors - electron.git/commitdiff
Disable renderer sandbox.
authorCheng Zhao <zcbenz@gmail.com>
Sat, 20 Apr 2013 03:19:25 +0000 (11:19 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 20 Apr 2013 03:19:25 +0000 (11:19 +0800)
app/atom_main_delegate.cc
app/atom_main_delegate.h

index 3bf42499238d61c70214d3ae7633b8ebc954ad95..0867aa9b95da22c469ba4aa25820b7c8a5fdee16 100644 (file)
@@ -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();
index 7ca793258865f34da67a6f16d6f814247426c079..2ff8af6a1da6a819171a0f8428d21d4098b24c75 100644 (file)
@@ -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*