diff --git a/embedding/tests/winEmbed/WebBrowserChrome.cpp b/embedding/tests/winEmbed/WebBrowserChrome.cpp index 33bbd11e6c89..32a38655406c 100644 --- a/embedding/tests/winEmbed/WebBrowserChrome.cpp +++ b/embedding/tests/winEmbed/WebBrowserChrome.cpp @@ -45,7 +45,6 @@ #include "nsIURI.h" #include "nsIWebProgress.h" #include "nsCWebBrowser.h" -#include "nsIProfileChangeStatus.h" // Glue APIs (not frozen, but safe to use because they are statically linked) #include "nsComponentManagerUtils.h" diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/extensions/pref/autoconfig/src/nsAutoConfig.cpp index 6ac4fc8def47..526c5a6d1573 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -14,7 +14,6 @@ #include "nsThreadUtils.h" #include "nsAppDirectoryServiceDefs.h" #include "prmem.h" -#include "nsIProfile.h" #include "nsIObserverService.h" #include "nsLiteralString.h" #include "nsIPromptService.h" @@ -180,21 +179,6 @@ NS_IMETHODIMP nsAutoConfig::Observe(nsISupports *aSubject, nsresult rv = NS_OK; if (!nsCRT::strcmp(aTopic, "profile-after-change")) { - // Getting the current profile name since we already have the - // pointer to the object. - nsCOMPtr profile = do_QueryInterface(aSubject); - if (profile) { - nsXPIDLString profileName; - rv = profile->GetCurrentProfile(getter_Copies(profileName)); - if (NS_SUCCEEDED(rv)) { - // setting the member variable to the current profile name - CopyUTF16toUTF8(profileName, mCurrProfile); - } - else { - NS_WARNING("nsAutoConfig::GetCurrentProfile() failed"); - } - } - // We will be calling downloadAutoConfig even if there is no profile // name. Nothing will be passed as a parameter to the URL and the // default case will be picked up by the script. @@ -496,8 +480,8 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr) getter_Copies(prefValue)); if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty()) emailAddr = prefValue; - else if (NS_FAILED(PromptForEMailAddress(emailAddr)) && (!mCurrProfile.IsEmpty())) - emailAddr = mCurrProfile; + else + PromptForEMailAddress(emailAddr); } return NS_OK; diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.h b/extensions/pref/autoconfig/src/nsAutoConfig.h index 8524345a7bf7..647efbce0a3a 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.h +++ b/extensions/pref/autoconfig/src/nsAutoConfig.h @@ -40,7 +40,7 @@ class nsAutoConfig : public nsIAutoConfig, nsresult writeFailoverFile(); nsresult getEmailAddr(nsACString & emailAddr); nsresult PromptForEMailAddress(nsACString &emailAddress); - nsCString mBuf, mCurrProfile; + nsCString mBuf; nsCOMPtr mPrefBranch; bool mLoaded; nsCOMPtr mTimer; diff --git a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h b/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h index 6c4ed898692a..bf00523923a5 100644 --- a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h +++ b/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h @@ -104,7 +104,7 @@ protected: * * @param aNotifyObservers If true, will send out profile startup * notifications when the profile directory is set. - * See nsIProfileChangeStatus. + * See notifications.txt */ nsresult NS_NewProfileDirServiceProvider(bool aNotifyObservers, diff --git a/profile/public/Makefile.in b/profile/public/Makefile.in index 859739eb56e0..64b7668eaa15 100644 --- a/profile/public/Makefile.in +++ b/profile/public/Makefile.in @@ -12,11 +12,6 @@ include $(DEPTH)/config/autoconf.mk MODULE = profile -SDK_XPIDLSRCS = \ - nsIProfile.idl \ - nsIProfileChangeStatus.idl \ - $(NULL) - XPIDLSRCS = \ nsIProfileUnlocker.idl \ $(NULL) diff --git a/profile/public/notifications.txt b/profile/public/notifications.txt new file mode 100644 index 000000000000..eab1e2c347ae --- /dev/null +++ b/profile/public/notifications.txt @@ -0,0 +1,61 @@ +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +nsIObserver topics for profile changing. Profile changing happens in phases +in the order given below. An observer may register separately for each phase +of the process depending on its needs. + +"profile-change-teardown" + All async activity must be stopped in this phase. Typically, + the application level observer will close all open windows. + This is the last phase in which the subject's vetoChange() + method may still be called. + The next notification will be either + profile-change-teardown-veto or profile-before-change. + +"profile-before-change" + Called before the profile has changed. Use this notification + to prepare for the profile going away. If a component is + holding any state which needs to be flushed to a profile-relative + location, it should be done here. + +"profile-do-change" + Called after the profile has changed. Do the work to + respond to having a new profile. Any change which + affects others must be done in this phase. + +"profile-after-change" + Called after the profile has changed. Use this notification + to make changes that are dependent on what some other listener + did during its profile-do-change. For example, to respond to + new preferences. + +"profile-initial-state" + Called after all phases of a change have completed. Typically + in this phase, an application level observer will open a new window. + +Contexts for profile changes. These are passed as the someData param to the +observer's Observe() method. + +"startup" + Going from no profile to a profile. + The following topics happen in this context: + profile-do-change + profile-after-change + +"shutdown-persist" + The user is logging out and whatever data the observer stores + for the current profile should be released from memory and + saved to disk. + The following topics happen in this context: + profile-change-net-teardown + profile-change-teardown + profile-before-change + +See https://wiki.mozilla.org/XPCOM_Shutdown for more details about the shutdown +process. + +NOTE: Long ago there was be a "shutdown-cleanse" version of shutdown which was +intended to clear profile data. This is no longer sent and observer code should +remove support for it. diff --git a/profile/public/nsIProfile.idl b/profile/public/nsIProfile.idl deleted file mode 100644 index 2c0a6b9d39dd..000000000000 --- a/profile/public/nsIProfile.idl +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" -#include "nsIFile.idl" - -%{C++ - -#define NS_PROFILE_CID \ - { /* {02b0625b-e7f3-11d2-9f5a-006008a6efe9} */ \ - 0x02b0625b, \ - 0xe7f3, \ - 0x11d2, \ - { 0x9f, 0x5a, 0x00, 0x60, 0x08, 0xa6, 0xef, 0xe9 } \ - } - -#define NS_PROFILE_CONTRACTID \ - "@mozilla.org/profile/manager;1" - -#define NS_PROFILE_STARTUP_CATEGORY \ - "profile-startup-category" -%} - -/** - * nsIProfile - * - * @version 1.0 - */ - -[scriptable, uuid(02b0625a-e7f3-11d2-9f5a-006008a6efe9)] -interface nsIProfile : nsISupports { - - readonly attribute long profileCount; - void getProfileList(out unsigned long length, [retval, array, size_is(length)] out wstring profileNames); - boolean profileExists(in wstring profileName); - - attribute wstring currentProfile; - - const unsigned long SHUTDOWN_PERSIST = 0x00000001; - const unsigned long SHUTDOWN_CLEANSE = 0x00000002; - - void shutDownCurrentProfile(in unsigned long shutDownType); - - void createNewProfile(in wstring profileName, - in wstring nativeProfileDir, - in wstring langcode, - in boolean useExistingDir); - - void renameProfile(in wstring oldName, in wstring newName); - void deleteProfile(in wstring name, in boolean canDeleteFiles); - void cloneProfile(in wstring profileName); -}; diff --git a/profile/public/nsIProfileChangeStatus.idl b/profile/public/nsIProfileChangeStatus.idl deleted file mode 100644 index 44539124a728..000000000000 --- a/profile/public/nsIProfileChangeStatus.idl +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -%{C++ - - /** - * nsIObserver topics for profile changing. Profile changing happens in phases - * in the order given below. An observer may register separately for each phase - * of the process depending on its needs. The subject passed to the observer's - * Observe() method can be QI'd to an nsIProfileChangeStatus. - * - * "profile-approve-change" - * Called before a profile change is attempted. Typically, - * the application level observer will ask the user if - * he/she wants to stop all network activity, close all open - * windows, etc. If the user says NO, the observer should - * call the subject's vetoChange(). If any observer does - * this, the profile will not be changed. - * - * "profile-change-teardown" - * All async activity must be stopped in this phase. Typically, - * the application level observer will close all open windows. - * This is the last phase in which the subject's vetoChange() - * method may still be called. - * The next notification will be either - * profile-change-teardown-veto or profile-before-change. - * - * "profile-change-teardown-veto" - * This notification will only be sent, if the profile change - * was vetoed during the profile-change-teardown phase. - * This allows components to bring back required resources, - * that were tore down on profile-change-teardown. - * - * "profile-before-change" - * Called before the profile has changed. Use this notification - * to prepare for the profile going away. If a component is - * holding any state which needs to be flushed to a profile-relative - * location, it should be done here. - * - * "profile-do-change" - * Called after the profile has changed. Do the work to - * respond to having a new profile. Any change which - * affects others must be done in this phase. - * - * "profile-after-change" - * Called after the profile has changed. Use this notification - * to make changes that are dependent on what some other listener - * did during its profile-do-change. For example, to respond to - * new preferences. - * - * "profile-initial-state" - * Called after all phases of a change have completed. Typically - * in this phase, an application level observer will open a new window. - * - * Contexts for profile changes. These are passed as the someData param to the - * observer's Observe() method. - - * "startup" - * Going from no profile to a profile. - * - * The following topics happen in this context: - * profile-do-change - * profile-after-change - * - * "shutdown-persist" - * The user is logging out and whatever data the observer stores - * for the current profile should be released from memory and - * saved to disk. - * - * "shutdown-cleanse" - * The user is logging out and whatever data the observer stores - * for the current profile should be released from memory and - * deleted from disk. - * - * The following topics happen in both shutdown contexts: - * profile-approve-change - * profile-change-teardown - * profile-before-change - * - * "switch" - * Going from one profile to another. - * - * All of the above topics happen in a profile switch. - * - */ -%} - - -[scriptable, uuid(2f977d43-5485-11d4-87e2-0010a4e75ef2)] -interface nsIProfileChangeStatus : nsISupports { - - void vetoChange(); - - /** - * Called by a profile change observer when a fatal error - * occurred during the attempt to switch the profile. - * - * The profile should be considered in an unsafe condition, - * and the profile manager should inform the user and - * exit immediately. - * - */ - void changeFailed(); - -}; diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 7d40e2857b3b..f31a88aaf286 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -12,7 +12,6 @@ #include "nsIObserverService.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" -#include "nsIProfileChangeStatus.h" #include "nsIPromptService.h" #include "nsIStringBundle.h" #include "nsISupportsPrimitives.h" diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 144e5e6e791a..23e6d4a8abd0 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -15,7 +15,6 @@ #include "nsIFile.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsIProfileChangeStatus.h" #include "nsISimpleEnumerator.h" #include "nsIToolkitChromeRegistry.h" @@ -835,32 +834,6 @@ nsXREDirProvider::DoStartup() return NS_OK; } -class ProfileChangeStatusImpl MOZ_FINAL : public nsIProfileChangeStatus -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROFILECHANGESTATUS - ProfileChangeStatusImpl() { } -private: - ~ProfileChangeStatusImpl() { } -}; - -NS_IMPL_ISUPPORTS1(ProfileChangeStatusImpl, nsIProfileChangeStatus) - -NS_IMETHODIMP -ProfileChangeStatusImpl::VetoChange() -{ - NS_ERROR("Can't veto change!"); - return NS_ERROR_FAILURE; -} - -NS_IMETHODIMP -ProfileChangeStatusImpl::ChangeFailed() -{ - NS_ERROR("Profile change cancellation."); - return NS_ERROR_FAILURE; -} - void nsXREDirProvider::DoShutdown() { @@ -869,11 +842,10 @@ nsXREDirProvider::DoShutdown() mozilla::services::GetObserverService(); NS_ASSERTION(obsSvc, "No observer service?"); if (obsSvc) { - nsCOMPtr cs = new ProfileChangeStatusImpl(); static const PRUnichar kShutdownPersist[] = {'s','h','u','t','d','o','w','n','-','p','e','r','s','i','s','t','\0'}; - obsSvc->NotifyObservers(cs, "profile-change-net-teardown", kShutdownPersist); - obsSvc->NotifyObservers(cs, "profile-change-teardown", kShutdownPersist); + obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist); + obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist); // Phase 2c: Now that things are torn down, force JS GC so that things which depend on // resources which are about to go away in "profile-before-change" are destroyed first. @@ -889,7 +861,7 @@ nsXREDirProvider::DoShutdown() } // Phase 3: Notify observers of a profile change - obsSvc->NotifyObservers(cs, "profile-before-change", kShutdownPersist); + obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist); } mProfileNotified = false; }