mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 4ebd50016f35 & 9033700cc24f (bug 807757) for failing to build on a CLOSED TREE
This commit is contained in:
parent
9bc024ab1e
commit
844fb967b0
@ -45,6 +45,7 @@
|
||||
#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"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "prmem.h"
|
||||
#include "nsIProfile.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsIPromptService.h"
|
||||
@ -179,6 +180,21 @@ 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<nsIProfile> 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.
|
||||
@ -480,8 +496,8 @@ nsresult nsAutoConfig::getEmailAddr(nsACString & emailAddr)
|
||||
getter_Copies(prefValue));
|
||||
if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty())
|
||||
emailAddr = prefValue;
|
||||
else
|
||||
PromptForEMailAddress(emailAddr);
|
||||
else if (NS_FAILED(PromptForEMailAddress(emailAddr)) && (!mCurrProfile.IsEmpty()))
|
||||
emailAddr = mCurrProfile;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -40,7 +40,7 @@ class nsAutoConfig : public nsIAutoConfig,
|
||||
nsresult writeFailoverFile();
|
||||
nsresult getEmailAddr(nsACString & emailAddr);
|
||||
nsresult PromptForEMailAddress(nsACString &emailAddress);
|
||||
nsCString mBuf;
|
||||
nsCString mBuf, mCurrProfile;
|
||||
nsCOMPtr<nsIPrefBranch> mPrefBranch;
|
||||
bool mLoaded;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
|
@ -104,7 +104,7 @@ protected:
|
||||
*
|
||||
* @param aNotifyObservers If true, will send out profile startup
|
||||
* notifications when the profile directory is set.
|
||||
* See notifications.txt
|
||||
* See nsIProfileChangeStatus.
|
||||
*/
|
||||
|
||||
nsresult NS_NewProfileDirServiceProvider(bool aNotifyObservers,
|
||||
|
@ -12,6 +12,11 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = profile
|
||||
|
||||
SDK_XPIDLSRCS = \
|
||||
nsIProfile.idl \
|
||||
nsIProfileChangeStatus.idl \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIProfileUnlocker.idl \
|
||||
$(NULL)
|
||||
|
@ -1,61 +0,0 @@
|
||||
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.
|
54
profile/public/nsIProfile.idl
Normal file
54
profile/public/nsIProfile.idl
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- 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);
|
||||
};
|
109
profile/public/nsIProfileChangeStatus.idl
Normal file
109
profile/public/nsIProfileChangeStatus.idl
Normal file
@ -0,0 +1,109 @@
|
||||
/* -*- 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();
|
||||
|
||||
};
|
@ -349,6 +349,8 @@ CrlImportFailureNetworkProblem=Download of the CRL failed due to Network problem
|
||||
CrlImportFailureReasonUnknown=Error Importing CRL to local Database. Error Code:
|
||||
CrlImportFailure2=Please ask your system administrator for assistance.
|
||||
NSSInitProblemX=Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory. Please check that this directory has no read/write restrictions and your hard disk is not full or close to full. It is recommended that you exit the application and fix the problem. If you continue to use this session, you might see incorrect application behaviour when accessing security features.
|
||||
ProfileSwitchSocketsStillActive=The operation cannot be completed because of an internal failure. A secure network communication has not been cleaned up correctly.
|
||||
ProfileSwitchCryptoUIActive=This operation is impossible at the current time. Please complete the operation that requests your attention in one of the other open windows.
|
||||
VerifyExpired=<Expired>
|
||||
VerifyRevoked=<Revoked>
|
||||
VerifyNotTrusted=<Not Trusted>
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIX509Cert.h"
|
||||
#include "nsIX509CertDB.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsNSSCertificate.h"
|
||||
#include "nsNSSHelper.h"
|
||||
#include "nsSmartCardMonitor.h"
|
||||
@ -1829,7 +1830,7 @@ nsNSSComponent::InitializeNSS(bool showWarningBox)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsresult
|
||||
nsNSSComponent::ShutdownNSS()
|
||||
{
|
||||
// Can be called both during init and profile change,
|
||||
@ -2153,7 +2154,9 @@ nsNSSComponent::RandomUpdate(void *entropy, int32_t bufLen)
|
||||
|
||||
#define PROFILE_CHANGE_NET_TEARDOWN_TOPIC "profile-change-net-teardown"
|
||||
#define PROFILE_CHANGE_NET_RESTORE_TOPIC "profile-change-net-restore"
|
||||
#define PROFILE_APPROVE_CHANGE_TOPIC "profile-approve-change"
|
||||
#define PROFILE_CHANGE_TEARDOWN_TOPIC "profile-change-teardown"
|
||||
#define PROFILE_CHANGE_TEARDOWN_VETO_TOPIC "profile-change-teardown-veto"
|
||||
#define PROFILE_BEFORE_CHANGE_TOPIC "profile-before-change"
|
||||
#define PROFILE_DO_CHANGE_TOPIC "profile-do-change"
|
||||
|
||||
@ -2161,10 +2164,16 @@ NS_IMETHODIMP
|
||||
nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
|
||||
const PRUnichar *someData)
|
||||
{
|
||||
if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0) {
|
||||
if (nsCRT::strcmp(aTopic, PROFILE_APPROVE_CHANGE_TOPIC) == 0) {
|
||||
DoProfileApproveChange(aSubject);
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0) {
|
||||
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("in PSM code, receiving change-teardown\n"));
|
||||
DoProfileChangeTeardown(aSubject);
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC) == 0) {
|
||||
mShutdownObjectList->allowUI();
|
||||
}
|
||||
else if (nsCRT::strcmp(aTopic, PROFILE_BEFORE_CHANGE_TOPIC) == 0) {
|
||||
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving profile change topic\n"));
|
||||
DoProfileBeforeChange(aSubject);
|
||||
@ -2178,6 +2187,7 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
|
||||
// it again. We use the same cleanup functionality used when switching
|
||||
// profiles. The order of function calls must correspond to the order
|
||||
// of notifications sent by Profile Manager (nsProfile).
|
||||
DoProfileApproveChange(aSubject);
|
||||
DoProfileChangeNetTeardown();
|
||||
DoProfileChangeTeardown(aSubject);
|
||||
DoProfileBeforeChange(aSubject);
|
||||
@ -2199,6 +2209,10 @@ nsNSSComponent::Observe(nsISupports *aSubject, const char *aTopic,
|
||||
if (needsInit) {
|
||||
if (NS_FAILED(InitializeNSS(false))) { // do not show a warning box on failure
|
||||
PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to Initialize NSS after profile switch.\n"));
|
||||
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
|
||||
if (status) {
|
||||
status->ChangeFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2400,7 +2414,9 @@ nsNSSComponent::RegisterObservers()
|
||||
|
||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||
|
||||
observerService->AddObserver(this, PROFILE_APPROVE_CHANGE_TOPIC, false);
|
||||
observerService->AddObserver(this, PROFILE_CHANGE_TEARDOWN_TOPIC, false);
|
||||
observerService->AddObserver(this, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC, false);
|
||||
observerService->AddObserver(this, PROFILE_BEFORE_CHANGE_TOPIC, false);
|
||||
observerService->AddObserver(this, PROFILE_DO_CHANGE_TOPIC, false);
|
||||
observerService->AddObserver(this, PROFILE_CHANGE_NET_TEARDOWN_TOPIC, false);
|
||||
@ -2423,7 +2439,9 @@ nsNSSComponent::DeregisterObservers()
|
||||
|
||||
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||
|
||||
observerService->RemoveObserver(this, PROFILE_APPROVE_CHANGE_TOPIC);
|
||||
observerService->RemoveObserver(this, PROFILE_CHANGE_TEARDOWN_TOPIC);
|
||||
observerService->RemoveObserver(this, PROFILE_CHANGE_TEARDOWN_VETO_TOPIC);
|
||||
observerService->RemoveObserver(this, PROFILE_BEFORE_CHANGE_TOPIC);
|
||||
observerService->RemoveObserver(this, PROFILE_DO_CHANGE_TOPIC);
|
||||
observerService->RemoveObserver(this, PROFILE_CHANGE_NET_TEARDOWN_TOPIC);
|
||||
@ -2463,6 +2481,23 @@ nsNSSComponent::RememberCert(CERTCertificate *cert)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char PROFILE_SWITCH_CRYPTO_UI_ACTIVE[] =
|
||||
"ProfileSwitchCryptoUIActive";
|
||||
static const char PROFILE_SWITCH_SOCKETS_STILL_ACTIVE[] =
|
||||
"ProfileSwitchSocketsStillActive";
|
||||
|
||||
void
|
||||
nsNSSComponent::DoProfileApproveChange(nsISupports* aSubject)
|
||||
{
|
||||
if (mShutdownObjectList->isUIActive()) {
|
||||
ShowAlertFromStringBundle(PROFILE_SWITCH_CRYPTO_UI_ACTIVE);
|
||||
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
|
||||
if (status) {
|
||||
status->VetoChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsNSSComponent::DoProfileChangeNetTeardown()
|
||||
{
|
||||
@ -2474,7 +2509,23 @@ nsNSSComponent::DoProfileChangeNetTeardown()
|
||||
void
|
||||
nsNSSComponent::DoProfileChangeTeardown(nsISupports* aSubject)
|
||||
{
|
||||
mShutdownObjectList->ifPossibleDisallowUI();
|
||||
bool callVeto = false;
|
||||
|
||||
if (!mShutdownObjectList->ifPossibleDisallowUI()) {
|
||||
callVeto = true;
|
||||
ShowAlertFromStringBundle(PROFILE_SWITCH_CRYPTO_UI_ACTIVE);
|
||||
}
|
||||
else if (mShutdownObjectList->areSSLSocketsActive()) {
|
||||
callVeto = true;
|
||||
ShowAlertFromStringBundle(PROFILE_SWITCH_SOCKETS_STILL_ACTIVE);
|
||||
}
|
||||
|
||||
if (callVeto) {
|
||||
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
|
||||
if (status) {
|
||||
status->VetoChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -2498,7 +2549,12 @@ nsNSSComponent::DoProfileBeforeChange(nsISupports* aSubject)
|
||||
StopCRLUpdateTimer();
|
||||
|
||||
if (needsCleanup) {
|
||||
ShutdownNSS();
|
||||
if (NS_FAILED(ShutdownNSS())) {
|
||||
nsCOMPtr<nsIProfileChangeStatus> status = do_QueryInterface(aSubject);
|
||||
if (status) {
|
||||
status->ChangeFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
mShutdownObjectList->allowUI();
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ public:
|
||||
private:
|
||||
|
||||
nsresult InitializeNSS(bool showWarningBox);
|
||||
void ShutdownNSS();
|
||||
nsresult ShutdownNSS();
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
void TryCFM2MachOMigration(nsIFile *cfmPath, nsIFile *machoPath);
|
||||
@ -294,6 +294,7 @@ private:
|
||||
|
||||
// Methods that we use to handle the profile change notifications (and to
|
||||
// synthesize a full profile change when we're just doing a profile startup):
|
||||
void DoProfileApproveChange(nsISupports* aSubject);
|
||||
void DoProfileChangeNetTeardown();
|
||||
void DoProfileChangeTeardown(nsISupports* aSubject);
|
||||
void DoProfileBeforeChange(nsISupports* aSubject);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIToolkitChromeRegistry.h"
|
||||
|
||||
@ -834,6 +835,32 @@ 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()
|
||||
{
|
||||
@ -842,10 +869,11 @@ nsXREDirProvider::DoShutdown()
|
||||
mozilla::services::GetObserverService();
|
||||
NS_ASSERTION(obsSvc, "No observer service?");
|
||||
if (obsSvc) {
|
||||
nsCOMPtr<nsIProfileChangeStatus> 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(nullptr, "profile-change-net-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(cs, "profile-change-net-teardown", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(cs, "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.
|
||||
@ -861,7 +889,7 @@ nsXREDirProvider::DoShutdown()
|
||||
}
|
||||
|
||||
// Phase 3: Notify observers of a profile change
|
||||
obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
|
||||
obsSvc->NotifyObservers(cs, "profile-before-change", kShutdownPersist);
|
||||
}
|
||||
mProfileNotified = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user