зеркало из https://github.com/mozilla/pjs.git
Bug 386810, Move quit-application-granted notification to nsAppStartup::Quit, r=benjamin
This commit is contained in:
Родитель
47ad439f24
Коммит
53435dd8bb
|
@ -64,7 +64,6 @@ function canQuitApplication()
|
|||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -97,24 +96,6 @@ function goQuitApplication()
|
|||
throw 'goQuitApplication: no AppStartup/appShell';
|
||||
}
|
||||
|
||||
var windowManager = Components.
|
||||
classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
|
||||
var windowManagerInterface = windowManager.
|
||||
QueryInterface(Components.interfaces.nsIWindowMediator);
|
||||
|
||||
var enumerator = windowManagerInterface.getEnumerator(null);
|
||||
|
||||
while (enumerator.hasMoreElements())
|
||||
{
|
||||
var domWindow = enumerator.getNext();
|
||||
if (("tryToClose" in domWindow) && !domWindow.tryToClose())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
domWindow.close();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
appService.quit(forceQuit);
|
||||
|
|
|
@ -64,7 +64,6 @@ function canQuitApplication()
|
|||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,6 @@ function canQuitApplication()
|
|||
catch (ex)
|
||||
{
|
||||
}
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -190,6 +190,11 @@ nsAppStartup::Quit(PRUint32 aMode)
|
|||
if (mShuttingDown)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsService
|
||||
(do_GetService("@mozilla.org/observer-service;1"));
|
||||
if (obsService)
|
||||
obsService->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
|
||||
/* eForceQuit doesn't actually work; it can cause a subtle crash if
|
||||
there are windows open which have unload handlers which open
|
||||
new windows. Use eAttemptQuit for now. */
|
||||
|
@ -264,8 +269,6 @@ nsAppStartup::Quit(PRUint32 aMode)
|
|||
|
||||
// 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<nsIObserverService> obsService
|
||||
(do_GetService("@mozilla.org/observer-service;1"));
|
||||
if (obsService) {
|
||||
NS_NAMED_LITERAL_STRING(shutdownStr, "shutdown");
|
||||
NS_NAMED_LITERAL_STRING(restartStr, "restart");
|
||||
|
|
|
@ -43,7 +43,6 @@ function canQuitApplication()
|
|||
return false;
|
||||
}
|
||||
catch (ex) { }
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1543,9 +1543,6 @@ function restartApp() {
|
|||
if (cancelQuit.data)
|
||||
return;
|
||||
|
||||
// Notify all windows that an application quit has been granted.
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
|
||||
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup)
|
||||
.quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
|
|
|
@ -212,9 +212,6 @@ function restartApp() {
|
|||
if (cancelQuit.data)
|
||||
return;
|
||||
|
||||
// Notify all windows that an application quit has been granted.
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
|
||||
Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(nsIAppStartup)
|
||||
.quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
|
||||
}
|
||||
|
|
|
@ -1655,9 +1655,6 @@ var gFinishedPage = {
|
|||
if (cancelQuit.data)
|
||||
return;
|
||||
|
||||
// Notify all windows that an application quit has been granted.
|
||||
os.notifyObservers(null, "quit-application-granted", null);
|
||||
|
||||
var appStartup =
|
||||
Components.classes["@mozilla.org/toolkit/app-startup;1"].
|
||||
getService(Components.interfaces.nsIAppStartup);
|
||||
|
|
|
@ -273,8 +273,6 @@ static NSWindow* GetCocoaWindowForXULWindow(nsISupports *aXULWindow)
|
|||
if (abortQuit)
|
||||
return NSTerminateCancel;
|
||||
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
|
||||
nsCOMPtr<nsIAppStartup> appService =
|
||||
do_GetService("@mozilla.org/toolkit/app-startup;1");
|
||||
if (appService)
|
||||
|
|
|
@ -480,7 +480,6 @@ OSErr nsMacCommandLine::Quit(TAskSave askSave)
|
|||
if (NS_FAILED(rv))
|
||||
return errAEEventNotHandled;
|
||||
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
appStartup->Quit(nsIAppStartup::eAttemptQuit);
|
||||
return noErr;
|
||||
}
|
||||
|
|
|
@ -117,14 +117,9 @@ gboolean save_yourself_cb(GnomeClient *client, gint phase,
|
|||
|
||||
void die_cb(GnomeClient *client, gpointer user_data)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
nsCOMPtr<nsIAppStartup> appService =
|
||||
do_GetService("@mozilla.org/toolkit/app-startup;1");
|
||||
|
||||
if (obsServ)
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
|
||||
if (appService)
|
||||
appService->Quit(nsIAppStartup::eForceQuit);
|
||||
}
|
||||
|
|
|
@ -646,14 +646,9 @@ struct MessageWindow {
|
|||
if (wp == FALSE)
|
||||
return TRUE;
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
nsCOMPtr<nsIAppStartup> appService =
|
||||
do_GetService("@mozilla.org/toolkit/app-startup;1");
|
||||
|
||||
if (obsServ)
|
||||
obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull);
|
||||
|
||||
if (appService)
|
||||
appService->Quit(nsIAppStartup::eForceQuit);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче