diff --git a/mailnews/base/resources/content/widgetglue.js b/mailnews/base/resources/content/widgetglue.js index 6d3fc20b2f38..8c0bdc8e3955 100644 --- a/mailnews/base/resources/content/widgetglue.js +++ b/mailnews/base/resources/content/widgetglue.js @@ -216,41 +216,6 @@ function MsgToggleSplitter(id) splitter.setAttribute("state", "collapsed") } -function NotifyQuitApplication() -{ - var ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(); - ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService); - if (ObserverService) - { - try - { - ObserverService.notifyObservers(null, "quit-application", null); - } - catch (ex) - { - // dump("no observer found \n"); - } - } -} - -function LastToClose() -{ - var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(); - var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator); - var enumerator = windowManagerInterface.getEnumerator( null ); - var count = 0; - - while ( enumerator.hasMoreElements() && count < 2 ) - { - var windowToClose = enumerator.getNext(); - count++; - } - if (count == 1) - return true; - else - return false; -} - function MsgSetFolderCharset() { MsgFolderProperties() diff --git a/mailnews/compose/resources/content/MsgComposeCommands.js b/mailnews/compose/resources/content/MsgComposeCommands.js index 3b27f9fdcf55..fc19cc9fb3e1 100644 --- a/mailnews/compose/resources/content/MsgComposeCommands.js +++ b/mailnews/compose/resources/content/MsgComposeCommands.js @@ -2140,8 +2140,6 @@ function ComposeCanClose() switch (result) { case 0: //Save - if (LastToClose()) - NotifyQuitApplication(); gCloseWindowAfterSave = true; SaveAsDraft(); return false; diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index 0757f5536f2c..2d359619ab48 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -583,10 +583,10 @@ nsAppShellService::Quit(PRUint32 aFerocity) if (aFerocity == eForceQuit) { // do it! -#ifdef MOZ_PHOENIX + // No chance of the shutdown being cancelled from here on; tell people + // we're shutting down for sure while all services are still available. nsCOMPtr obsService = do_GetService("@mozilla.org/observer-service;1", &rv); obsService->NotifyObservers(nsnull, "quit-application", nsnull); -#endif // first shutdown native app support; doing this first will prevent new // requests to open additional windows coming in. diff --git a/xpfe/global/resources/content/globalOverlay.js b/xpfe/global/resources/content/globalOverlay.js index 992d77834635..483a642f62b2 100644 --- a/xpfe/global/resources/content/globalOverlay.js +++ b/xpfe/global/resources/content/globalOverlay.js @@ -6,7 +6,9 @@ function goQuitApplication() { try { - ObserverService.notifyObservers(null, "quit-application", null); + // XXX FIX! we should have a way to cancel a requested quit; see + // bugzilla bug 149764 + ObserverService.notifyObservers(null, "quit-application-requested", null); } catch (ex) {