Bug 1513855 ensure we notify quit application when running silent r=kmag

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Shane Caraveo 2019-08-16 23:09:25 +00:00
Родитель 595de881b0
Коммит 8cc7d865b8
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -1034,6 +1034,19 @@ nsDefaultCommandLineHandler.prototype = {
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);
}
},