diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 34e543f7f6d..05d0b82f4cb 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -444,19 +444,19 @@ nsresult nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) { nsresult rv; - nsCOMPtr prefBranch; nsCOMPtr profileURL; PRInt32 numProfiles=0; - nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); - if (NS_FAILED(rv)) return rv; - rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)); - if (NS_FAILED(rv)) return rv; - GetProfileCount(&numProfiles); if (profileURLStr.IsEmpty()) { + nsCOMPtr prefBranch; + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); + if (NS_FAILED(rv)) return rv; + rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)); + if (NS_FAILED(rv)) return rv; + // If this flag is TRUE, it makes the multiple profile case // just like the single profile case - the profile will be // set to that returned by GetCurrentProfile(). It will prevent @@ -552,44 +552,6 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr, PRBool canInteract) if (NS_FAILED(rv)) return rv; } - nsCOMPtr catman = - do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); - - if(NS_SUCCEEDED(rv) && catman) - { - nsCOMPtr enumItem; - rv = catman->EnumerateCategory(NS_PROFILE_STARTUP_CATEGORY, getter_AddRefs(enumItem)); - if(NS_SUCCEEDED(rv) && enumItem) - { - while (PR_TRUE) - { - nsCOMPtr contractid; - - rv = enumItem->GetNext(getter_AddRefs(contractid)); - if (NS_FAILED(rv) || !contractid) break; - - nsCAutoString contractidString; - contractid->GetData(contractidString); - - nsCOMPtr listener = do_CreateInstance(contractidString.get(), &rv); - - if (listener) - listener->OnProfileStartup(currentProfileStr); - } - } - } - - PRBool prefs_converted = PR_FALSE; - (void)prefBranch->GetBoolPref("prefs.converted-to-utf8", &prefs_converted); - - if (!prefs_converted) - { - nsCOMPtr pPrefConverter = do_CreateInstance(kPrefConverterCID, &rv); - if (!pPrefConverter) return NS_ERROR_FAILURE; - rv = pPrefConverter->ConvertPrefsToUTF8(); - if (NS_FAILED(rv)) return rv; - } - return NS_OK; } @@ -1284,6 +1246,51 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile) if (mProfileChangeFailed) return NS_ERROR_ABORT; + nsCOMPtr catman = + do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); + + if(NS_SUCCEEDED(rv) && catman) + { + nsCOMPtr enumItem; + rv = catman->EnumerateCategory(NS_PROFILE_STARTUP_CATEGORY, getter_AddRefs(enumItem)); + if(NS_SUCCEEDED(rv) && enumItem) + { + while (PR_TRUE) + { + nsCOMPtr contractid; + + rv = enumItem->GetNext(getter_AddRefs(contractid)); + if (NS_FAILED(rv) || !contractid) break; + + nsCAutoString contractidString; + contractid->GetData(contractidString); + + nsCOMPtr listener = do_GetService(contractidString.get(), &rv); + + if (listener) + listener->OnProfileStartup(aCurrentProfile); + } + } + } + + nsCOMPtr prefBranch; + + nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); + if (NS_FAILED(rv)) return rv; + rv = prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)); + if (NS_FAILED(rv)) return rv; + + PRBool prefs_converted = PR_FALSE; + (void)prefBranch->GetBoolPref("prefs.converted-to-utf8", &prefs_converted); + + if (!prefs_converted) + { + nsCOMPtr pPrefConverter = do_GetService(kPrefConverterCID, &rv); + if (!pPrefConverter) return NS_ERROR_FAILURE; + rv = pPrefConverter->ConvertPrefsToUTF8(); + if (NS_FAILED(rv)) return rv; + } + return NS_OK; } diff --git a/mozilla/xpfe/components/updates/src/nsUpdateNotifier.js b/mozilla/xpfe/components/updates/src/nsUpdateNotifier.js index 8a19e920743..b68222d8e27 100644 --- a/mozilla/xpfe/components/updates/src/nsUpdateNotifier.js +++ b/mozilla/xpfe/components/updates/src/nsUpdateNotifier.js @@ -57,10 +57,17 @@ const kUNBundleURI = var nsUpdateNotifier = { + mInitialized: false, + onProfileStartup: function(aProfileName) { debug("onProfileStartup"); + // Check if we've already been called. + if (this.mInitialized) + return; + this.mInitialized = true; + // now wait for the first app window to open var observerService = Components. classes["@mozilla.org/observer-service;1"].