Bug 1513855 ensure we notify quit application when running silent r=kmag, a=RyanVM DEVEDITION_69_0b15_BUILD1 DEVEDITION_69_0b15_RELEASE FIREFOX_69_0b15_BUILD1 FIREFOX_69_0b15_RELEASE
authorShane Caraveo <scaraveo@mozilla.com>
Fri, 16 Aug 2019 23:09:25 +0000
changeset 545185 66a12ddcf77c6a1548989ced39edf39af78deb80
parent 545184 9b2474ad94517039fcc1c23732c829c13b1e5d62
child 545186 36859908a40c0aa2f6f8115f203e810180a60cbe
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, RyanVM
bugs1513855
milestone69.0
Bug 1513855 ensure we notify quit application when running silent r=kmag, a=RyanVM Running with -silent does not result in the quit application granted notification. Without that notification, we have a deadlock in EnvironmentAddonBuilder where it blocks beforeShutdown waiting on the XPIDatabase to load. Differential Revision: https://phabricator.services.mozilla.com/D41877
browser/components/BrowserContentHandler.jsm
--- a/browser/components/BrowserContentHandler.jsm
+++ b/browser/components/BrowserContentHandler.jsm
@@ -1036,13 +1036,26 @@ nsDefaultCommandLineHandler.prototype = 
       // Need a better solution in the future to avoid opening the blank window
       // when command line parameters say we are not going to show a browser
       // window, but for now the blank window getting closed quickly (and
       // causing only a slight flicker) is better than leaving it open.
       let win = Services.wm.getMostRecentWindow("navigator:blank");
       if (win) {
         win.close();
       }
+      // If this is a silent run where we do not open any window, we must
+      // notify shutdown so that the quit-application-granted notification
+      // will happen.  This is required in the AddonManager to properly
+      // handle shutdown blockers for Telemetry and XPIDatabase.
+      // Some command handlers open a window asynchronously, so lets give
+      // that time and then verify that a window was not opened before
+      // quiting.
+      Services.tm.idleDispatchToMainThread(() => {
+        win = Services.wm.getMostRecentWindow(null);
+        if (!win) {
+          Services.startup.quit(Services.startup.eForceQuit);
+        }
+      }, 1);
     }
   },
 
   helpInfo: "",
 };