зеркало из https://github.com/mozilla/gecko-dev.git
need to be able to Quit viewer via AppleEvent. r=sfraser
This commit is contained in:
Родитель
cca325f64a
Коммит
2e05fff9a0
|
@ -364,6 +364,19 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID)
|
|||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quit AppleEvent handler.
|
||||
*/
|
||||
static pascal OSErr handleQuitApplication(const AppleEvent*, AppleEvent*, long)
|
||||
{
|
||||
if (gTheApp != nsnull) {
|
||||
gTheApp->Exit();
|
||||
} else {
|
||||
ExitToShell();
|
||||
}
|
||||
return noErr;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
//----------------------------------------------------------------------
|
||||
int main(int argc, char **argv)
|
||||
|
@ -371,6 +384,11 @@ int main(int argc, char **argv)
|
|||
// Set up the toolbox and (if DEBUG) the console
|
||||
InitializeMacToolbox();
|
||||
|
||||
// Install an a Quit AppleEvent handler.
|
||||
OSErr err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
|
||||
NewAEEventHandlerProc(handleQuitApplication), 0, false);
|
||||
NS_ASSERTION((err==noErr), "AEInstallEventHandler failed");
|
||||
|
||||
// Start up XPCOM?
|
||||
nsresult rv = NS_InitXPCOM(nsnull, nsnull, nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
|
||||
|
@ -387,6 +405,12 @@ int main(int argc, char **argv)
|
|||
NS_RELEASE(gTheApp);
|
||||
}
|
||||
|
||||
#ifdef DETECT_WEBSHELL_LEAKS
|
||||
if ( unsigned long count = NS_TotalWebShellsInExistence() ) {
|
||||
printf("XXX WARNING: Number of webshells being leaked: %d \n", count);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shutdown XPCOM?
|
||||
rv = NS_ShutdownXPCOM(nsnull);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
|
||||
|
|
Загрузка…
Ссылка в новой задаче