Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 275672 Details for
Bug 386810
[patch]
Move quit-application-granted notifications
386810v1.patch (text/plain), 11.26 KB, created by
Michael Wu [:mwu]
(
hide
)
Description:
Move quit-application-granted notifications
Filename:
MIME Type:
Creator:
Michael Wu [:mwu]
Size:
11.26 KB
patch
obsolete
>diff --git a/layout/tools/pageloader/quit.js b/layout/tools/pageloader/quit.js >index ab3b0fd..9a212d6 100644 >--- a/layout/tools/pageloader/quit.js >+++ b/layout/tools/pageloader/quit.js >@@ -59,17 +59,16 @@ function canQuitApplication() > if (cancelQuit.data) > { > return false; > } > } > catch (ex) > { > } >- os.notifyObservers(null, "quit-application-granted", null); > return true; > } > > function goQuitApplication() > { > if (!canQuitApplication()) > { > return false; >@@ -92,34 +91,16 @@ function goQuitApplication() > getService(Components.interfaces.nsIAppShellService); > forceQuit = Components.interfaces.nsIAppShellService.eForceQuit; > } > else > { > 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); > } > catch(ex) > { > throw('goQuitApplication: ' + ex); > } >diff --git a/layout/tools/reftest/quit.js b/layout/tools/reftest/quit.js >index e5031d4..9a212d6 100644 >--- a/layout/tools/reftest/quit.js >+++ b/layout/tools/reftest/quit.js >@@ -59,17 +59,16 @@ function canQuitApplication() > if (cancelQuit.data) > { > return false; > } > } > catch (ex) > { > } >- os.notifyObservers(null, "quit-application-granted", null); > return true; > } > > function goQuitApplication() > { > if (!canQuitApplication()) > { > return false; >diff --git a/testing/mochitest/tests/SimpleTest/quit.js b/testing/mochitest/tests/SimpleTest/quit.js >index 8b2a339..67c5cc8 100644 >--- a/testing/mochitest/tests/SimpleTest/quit.js >+++ b/testing/mochitest/tests/SimpleTest/quit.js >@@ -73,17 +73,16 @@ function canQuitApplication() > if (cancelQuit.data) > { > return false; > } > } > catch (ex) > { > } >- os.notifyObservers(null, "quit-application-granted", null); > return true; > } > > function goQuitApplication() > { > const privs = 'UniversalXPConnect'; > > try >diff --git a/toolkit/components/startup/src/nsAppStartup.cpp b/toolkit/components/startup/src/nsAppStartup.cpp >index 60dc2f3..6ec6fa5 100644 >--- a/toolkit/components/startup/src/nsAppStartup.cpp >+++ b/toolkit/components/startup/src/nsAppStartup.cpp >@@ -185,16 +185,21 @@ nsAppStartup::Quit(PRUint32 aMode) > // Exit() method via nsAppExitEvent to allow one last pass > // through any events in the queue. This guarantees a tidy cleanup. > nsresult rv = NS_OK; > PRBool postedExitEvent = PR_FALSE; > > 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. */ > if (ferocity == eForceQuit) { > NS_WARNING("attempted to force quit"); > // it will be treated the same as eAttemptQuit, below > } > >@@ -259,18 +264,16 @@ nsAppStartup::Quit(PRUint32 aMode) > } > } > > if (ferocity == eForceQuit) { > // do it! > > // 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"); > obsService->NotifyObservers(nsnull, "quit-application", > mRestart ? restartStr.get() : shutdownStr.get()); > } > > nsCOMPtr<nsIAppShellService> appShellService >diff --git a/toolkit/content/globalOverlay.js b/toolkit/content/globalOverlay.js >index bd1a28a..6efa765 100644 >--- a/toolkit/content/globalOverlay.js >+++ b/toolkit/content/globalOverlay.js >@@ -38,17 +38,16 @@ function canQuitApplication() > .createInstance(Components.interfaces.nsISupportsPRBool); > os.notifyObservers(cancelQuit, "quit-application-requested", null); > > // Something aborted the quit process. > if (cancelQuit.data) > return false; > } > catch (ex) { } >- os.notifyObservers(null, "quit-application-granted", null); > return true; > } > > function goQuitApplication() > { > if (!canQuitApplication()) > return false; > >diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js >index 43765e2..5bbec8c 100644 >--- a/toolkit/mozapps/extensions/content/extensions.js >+++ b/toolkit/mozapps/extensions/content/extensions.js >@@ -1584,19 +1584,16 @@ function restartApp() { > var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"] > .createInstance(Components.interfaces.nsISupportsPRBool); > os.notifyObservers(cancelQuit, "quit-application-requested", "restart"); > > // Something aborted the quit process. > 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); > } > > function installWithFilePicker() { > if (!isXPInstallEnabled()) > return; > >diff --git a/toolkit/mozapps/extensions/content/list.js b/toolkit/mozapps/extensions/content/list.js >index 8c8a623..b2922df 100755 >--- a/toolkit/mozapps/extensions/content/list.js >+++ b/toolkit/mozapps/extensions/content/list.js >@@ -207,19 +207,16 @@ function restartApp() { > var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"] > .createInstance(Components.interfaces.nsISupportsPRBool); > os.notifyObservers(cancelQuit, "quit-application-requested", null); > > // Something aborted the quit process. > 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); > } > > /** > * Watch for the user hitting one of the buttons to dismiss the dialog > * and report the result back to the caller through the |result| property on > * the arguments object. >diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js >index b08a631..43769d4 100755 >--- a/toolkit/mozapps/update/content/updates.js >+++ b/toolkit/mozapps/update/content/updates.js >@@ -1650,19 +1650,16 @@ var gFinishedPage = { > Components.classes["@mozilla.org/supports-PRBool;1"]. > createInstance(Components.interfaces.nsISupportsPRBool); > os.notifyObservers(cancelQuit, "quit-application-requested", "restart"); > > // Something aborted the quit process. > 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); > appStartup.quit(appStartup.eAttemptQuit | appStartup.eRestart); > }, > > /** > * Called when the wizard is canceled, i.e. when the "Later" button is >diff --git a/toolkit/xre/MacApplicationDelegate.mm b/toolkit/xre/MacApplicationDelegate.mm >index 79da26e..6bb4c51 100644 >--- a/toolkit/xre/MacApplicationDelegate.mm >+++ b/toolkit/xre/MacApplicationDelegate.mm >@@ -268,18 +268,16 @@ static NSWindow* GetCocoaWindowForXULWin > cancelQuit->SetData(PR_FALSE); > obsServ->NotifyObservers(cancelQuit, "quit-application-requested", nsnull); > > PRBool abortQuit; > cancelQuit->GetData(&abortQuit); > if (abortQuit) > return NSTerminateCancel; > >- obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull); >- > nsCOMPtr<nsIAppStartup> appService = > do_GetService("@mozilla.org/toolkit/app-startup;1"); > if (appService) > appService->Quit(nsIAppStartup::eForceQuit); > > return NSTerminateNow; > } > >diff --git a/toolkit/xre/nsCommandLineServiceMac.cpp b/toolkit/xre/nsCommandLineServiceMac.cpp >index 9d11df5..adef0a9 100644 >--- a/toolkit/xre/nsCommandLineServiceMac.cpp >+++ b/toolkit/xre/nsCommandLineServiceMac.cpp >@@ -475,17 +475,16 @@ OSErr nsMacCommandLine::Quit(TAskSave as > if (abortQuit) > return userCanceledErr; > > nsCOMPtr<nsIAppStartup> appStartup = > do_GetService(NS_APPSTARTUP_CONTRACTID, &rv); > if (NS_FAILED(rv)) > return errAEEventNotHandled; > >- obsServ->NotifyObservers(nsnull, "quit-application-granted", nsnull); > appStartup->Quit(nsIAppStartup::eAttemptQuit); > return noErr; > } > > #pragma mark - > > //---------------------------------------------------------------------------------------- > void SetupMacCommandLine(int& argc, char**& argv) >diff --git a/toolkit/xre/nsNativeAppSupportUnix.cpp b/toolkit/xre/nsNativeAppSupportUnix.cpp >index 55de426..807697b 100644 >--- a/toolkit/xre/nsNativeAppSupportUnix.cpp >+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp >@@ -112,24 +112,19 @@ gboolean save_yourself_cb(GnomeClient *c > if (interact == GNOME_INTERACT_ANY) > gnome_client_request_interaction(client, GNOME_DIALOG_NORMAL, > interact_cb, nsnull); > return TRUE; > } > > 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); > } > > class nsNativeAppSupportUnix : public nsNativeAppSupportBase > { > public: > NS_IMETHOD Start(PRBool* aRetVal); >diff --git a/toolkit/xre/nsNativeAppSupportWin.cpp b/toolkit/xre/nsNativeAppSupportWin.cpp >index e319bfb..6c310a5 100644 >--- a/toolkit/xre/nsNativeAppSupportWin.cpp >+++ b/toolkit/xre/nsNativeAppSupportWin.cpp >@@ -641,24 +641,19 @@ #endif > return !abortQuit; > } else if ( msg == WM_ENDSESSION ) { > if (!nsNativeAppSupportWin::mCanHandleRequests) > return FALSE; > > 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); > > return TRUE; > } > return DefWindowProc( msgWindow, msg, wp, lp ); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Flags:
benjamin
: review+
Actions:
View
|
Diff
|
Review
Attachments on
bug 386810
: 275672