From cfe21df0aaeacbbf4ba740de0b5be7535f3c23bd Mon Sep 17 00:00:00 2001 From: "robin.lu%sun.com" Date: Sat, 30 Apr 2005 02:37:41 +0000 Subject: [PATCH] fix bug 290435 proxy settings are disabled after switching profiles. alecf: review+ neil.parkwaycc.co.uk: superreview+ patched by Boying Lu --- extensions/pref/system-pref/src/nsSystemPref.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/extensions/pref/system-pref/src/nsSystemPref.cpp b/extensions/pref/system-pref/src/nsSystemPref.cpp index 1b872d05d0f3..8a0edf20aee5 100644 --- a/extensions/pref/system-pref/src/nsSystemPref.cpp +++ b/extensions/pref/system-pref/src/nsSystemPref.cpp @@ -122,6 +122,8 @@ nsSystemPref::Init(void) if (observerService) { rv = observerService->AddObserver(this, NS_PREFSERVICE_READ_TOPIC_ID, PR_FALSE); + rv = observerService->AddObserver(this, "profile-before-change", + PR_FALSE); SYSPREF_LOG(("Add Observer for %s\n", NS_PREFSERVICE_READ_TOPIC_ID)); } return(rv); @@ -211,8 +213,15 @@ nsSystemPref::Observe(nsISupports *aSubject, aTopic, (char*)aData)); rv = ReadSystemPref(NS_LossyConvertUCS2toASCII(aData).get()); return NS_OK; - } - else + } else if (!nsCRT::strcmp(aTopic,"profile-before-change")) { + //roll back to mozilla prefs + if (mEnabled) + UseMozillaPrefs(); + mEnabled = PR_FALSE; + mSysPrefService = nsnull; + delete [] mSysPrefs; + mSysPrefs = nsnull; + } else SYSPREF_LOG(("Not needed topic Received %s\n", aTopic)); return rv; }