Bug 711670: Setup the Mac Application Delegate earlier to respond to URLs clicked in external applications when updates are pending. r=mstange
authorStephen A Pohl <spohl.mozilla.bugs@gmail.com>
Thu, 21 Apr 2016 16:04:59 -0400
changeset 294126 b31b99289389a5e0ddab1ca9eccd4f03a6d81fe4
parent 294125 5f5b4ff17b1de061558edcccd2c9e15106359a46
child 294127 2570cd8ec0bddf821299063db4094dbbaeccea04
push id18861
push userspohl@mozilla.com
push dateThu, 21 Apr 2016 20:04:46 +0000
treeherderfx-team@b31b99289389 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs711670
milestone48.0a1
Bug 711670: Setup the Mac Application Delegate earlier to respond to URLs clicked in external applications when updates are pending. r=mstange
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3386,16 +3386,21 @@ XREMain::XRE_mainInit(bool* aExitFlag)
 #endif
     // Otherwise just warn for the moment, as most things will work.
     NS_WARNING("Failed to initialize broker services, sandboxed processes will "
                "fail to start.");
   }
 #endif
 
 #ifdef XP_MACOSX
+  // Set up ability to respond to system (Apple) events. This must occur before
+  // ProcessUpdates to ensure that links clicked in external applications aren't
+  // lost when updates are pending.
+  SetupMacApplicationDelegate();
+
   if (EnvHasValue("MOZ_LAUNCHED_CHILD")) {
     // This is needed, on relaunch, to force the OS to use the "Cocoa Dock
     // API".  Otherwise the call to ReceiveNextEvent() below will make it
     // use the "Carbon Dock API".  For more info see bmo bug 377166.
     EnsureUseCocoaDockAPI();
 
     // When the app relaunches, the original process exits.  This causes
     // the dock tile to stop bouncing, lose the "running" triangle, and
@@ -4281,20 +4286,16 @@ XREMain::XRE_mainRun()
       toolkit->SetDesktopStartupID(mDesktopStartupID);
     }
     // Clear the environment variable so it won't be inherited by
     // child processes and confuse things.
     g_unsetenv ("DESKTOP_STARTUP_ID");
 #endif
 
 #ifdef XP_MACOSX
-    // Set up ability to respond to system (Apple) events. This must be
-    // done before setting up the command line service.
-    SetupMacApplicationDelegate();
-
     // we re-initialize the command-line service and do appleevents munging
     // after we are sure that we're not restarting
     cmdLine = do_CreateInstance("@mozilla.org/toolkit/command-line;1");
     NS_ENSURE_TRUE(cmdLine, NS_ERROR_FAILURE);
 
     CommandLineServiceMac::SetupMacCommandLine(gArgc, gArgv, false);
 
     rv = cmdLine->Init(gArgc, gArgv,