From 33580f66df24c047cc4bc4942e90f52588e4b317 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 4 Aug 2014 20:50:05 +0800 Subject: [PATCH] Run user's main script before everything is initialized, fixes #543. --- atom/browser/atom_browser_main_parts.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index d8833674..d507e40c 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -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(AtomBrowserContext::Get())-> GetRequestContext(); -- 2.43.0