]> khamidou — GitHub mirrors - electron.git/commitdiff
Run user's main script before everything is initialized, fixes #543.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 4 Aug 2014 12:50:05 +0000 (20:50 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 4 Aug 2014 12:51:08 +0000 (20:51 +0800)
atom/browser/atom_browser_main_parts.cc

index d883367495bc2c93f22a2f055cf69a78c1812aac..d507e40c8a8997dc5196a84d9a45d5c7e250e3d1 100644 (file)
@@ -65,17 +65,18 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
 }
 
 void AtomBrowserMainParts::PreMainMessageLoopRun() {
+  // Run user's main script before most things get initialized, so we can have
+  // a chance to setup everything.
+  node_bindings_->PrepareMessageLoop();
+  node_bindings_->RunMessageLoop();
+
   brightray::BrowserMainParts::PreMainMessageLoopRun();
 
 #if defined(USE_X11)
   libgtk2ui::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess());
 #endif
 
-  node_bindings_->PrepareMessageLoop();
-  node_bindings_->RunMessageLoop();
-
-  // Make sure the url request job factory is created before the
-  // will-finish-launching event.
+  // Make sure the url request job factory is created before the ready event.
   static_cast<content::BrowserContext*>(AtomBrowserContext::Get())->
       GetRequestContext();