|
|
|
|
| 185 |
// Exit() method via nsAppExitEvent to allow one last pass |
185 |
// Exit() method via nsAppExitEvent to allow one last pass |
| 186 |
// through any events in the queue. This guarantees a tidy cleanup. |
186 |
// through any events in the queue. This guarantees a tidy cleanup. |
| 187 |
nsresult rv = NS_OK; |
187 |
nsresult rv = NS_OK; |
| 188 |
PRBool postedExitEvent = PR_FALSE; |
188 |
PRBool postedExitEvent = PR_FALSE; |
| 189 |
|
189 |
|
| 190 |
if (mShuttingDown) |
190 |
if (mShuttingDown) |
| 191 |
return NS_OK; |
191 |
return NS_OK; |
| 192 |
|
192 |
|
|
|
193 |
nsCOMPtr<nsIObserverService> obsService |
| 194 |
(do_GetService("@mozilla.org/observer-service;1")); |
| 195 |
if (obsService) |
| 196 |
obsService->NotifyObservers(nsnull, "quit-application-granted", nsnull); |
| 197 |
|
| 193 |
/* eForceQuit doesn't actually work; it can cause a subtle crash if |
198 |
/* eForceQuit doesn't actually work; it can cause a subtle crash if |
| 194 |
there are windows open which have unload handlers which open |
199 |
there are windows open which have unload handlers which open |
| 195 |
new windows. Use eAttemptQuit for now. */ |
200 |
new windows. Use eAttemptQuit for now. */ |
| 196 |
if (ferocity == eForceQuit) { |
201 |
if (ferocity == eForceQuit) { |
| 197 |
NS_WARNING("attempted to force quit"); |
202 |
NS_WARNING("attempted to force quit"); |
| 198 |
// it will be treated the same as eAttemptQuit, below |
203 |
// it will be treated the same as eAttemptQuit, below |
| 199 |
} |
204 |
} |
| 200 |
|
205 |
|
|
|
| 259 |
} |
264 |
} |
| 260 |
} |
265 |
} |
| 261 |
|
266 |
|
| 262 |
if (ferocity == eForceQuit) { |
267 |
if (ferocity == eForceQuit) { |
| 263 |
// do it! |
268 |
// do it! |
| 264 |
|
269 |
|
| 265 |
// No chance of the shutdown being cancelled from here on; tell people |
270 |
// No chance of the shutdown being cancelled from here on; tell people |
| 266 |
// we're shutting down for sure while all services are still available. |
271 |
// we're shutting down for sure while all services are still available. |
| 267 |
nsCOMPtr<nsIObserverService> obsService |
|
|
| 268 |
(do_GetService("@mozilla.org/observer-service;1")); |
| 269 |
if (obsService) { |
272 |
if (obsService) { |
| 270 |
NS_NAMED_LITERAL_STRING(shutdownStr, "shutdown"); |
273 |
NS_NAMED_LITERAL_STRING(shutdownStr, "shutdown"); |
| 271 |
NS_NAMED_LITERAL_STRING(restartStr, "restart"); |
274 |
NS_NAMED_LITERAL_STRING(restartStr, "restart"); |
| 272 |
obsService->NotifyObservers(nsnull, "quit-application", |
275 |
obsService->NotifyObservers(nsnull, "quit-application", |
| 273 |
mRestart ? restartStr.get() : shutdownStr.get()); |
276 |
mRestart ? restartStr.get() : shutdownStr.get()); |
| 274 |
} |
277 |
} |
| 275 |
|
278 |
|
| 276 |
nsCOMPtr<nsIAppShellService> appShellService |
279 |
nsCOMPtr<nsIAppShellService> appShellService |