diff --git a/chrome/src/nsChromeRegistry.h b/chrome/src/nsChromeRegistry.h index 3f82b2367c8..81b246899b7 100644 --- a/chrome/src/nsChromeRegistry.h +++ b/chrome/src/nsChromeRegistry.h @@ -116,7 +116,7 @@ protected: // Update the selected locale used by the chrome registry, and fire a // notification about this change - virtual void UpdateSelectedLocale() = 0; + virtual nsresult UpdateSelectedLocale() = 0; static void LogMessage(const char* aMsg, ...); static void LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUint32 flags, diff --git a/chrome/src/nsChromeRegistryChrome.cpp b/chrome/src/nsChromeRegistryChrome.cpp index 3ca506ba999..c223a36227e 100644 --- a/chrome/src/nsChromeRegistryChrome.cpp +++ b/chrome/src/nsChromeRegistryChrome.cpp @@ -368,12 +368,9 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic, if (pref.EqualsLiteral(MATCH_OS_LOCALE_PREF) || pref.EqualsLiteral(SELECTED_LOCALE_PREF)) { - if (!mProfileLoaded) { - rv = SelectLocaleFromPref(prefs); - if (NS_FAILED(rv)) - return rv; - } - FlushAllCaches(); + rv = UpdateSelectedLocale(); + if (NS_SUCCEEDED(rv) && mProfileLoaded) + FlushAllCaches(); } else if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) { nsXPIDLCString provider; @@ -426,11 +423,12 @@ nsChromeRegistryChrome::CheckForNewChrome() return NS_OK; } -void nsChromeRegistryChrome::UpdateSelectedLocale() +nsresult nsChromeRegistryChrome::UpdateSelectedLocale() { + nsresult rv = NS_OK; nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); if (prefs) { - nsresult rv = SelectLocaleFromPref(prefs); + rv = SelectLocaleFromPref(prefs); if (NS_SUCCEEDED(rv)) { nsCOMPtr obsSvc = mozilla::services::GetObserverService(); @@ -439,6 +437,8 @@ void nsChromeRegistryChrome::UpdateSelectedLocale() "selected-locale-has-changed", nsnull); } } + + return rv; } static void diff --git a/chrome/src/nsChromeRegistryChrome.h b/chrome/src/nsChromeRegistryChrome.h index 44bd07c7f0a..8bd6cedfecb 100644 --- a/chrome/src/nsChromeRegistryChrome.h +++ b/chrome/src/nsChromeRegistryChrome.h @@ -83,7 +83,7 @@ class nsChromeRegistryChrome : public nsChromeRegistry PRUint32 number, void *arg); nsresult SelectLocaleFromPref(nsIPrefBranch* prefs); - NS_OVERRIDE void UpdateSelectedLocale(); + NS_OVERRIDE nsresult UpdateSelectedLocale(); NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, const nsCString& aProvider, const nsCString& aPath); diff --git a/chrome/src/nsChromeRegistryContent.cpp b/chrome/src/nsChromeRegistryContent.cpp index d5982833e9f..cc7c11885f3 100644 --- a/chrome/src/nsChromeRegistryContent.cpp +++ b/chrome/src/nsChromeRegistryContent.cpp @@ -278,9 +278,9 @@ nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL, CONTENT_NOT_IMPLEMENTED(); } -void nsChromeRegistryContent::UpdateSelectedLocale() +nsresult nsChromeRegistryContent::UpdateSelectedLocale() { - CONTENT_NOTREACHED(); + CONTENT_NOT_IMPLEMENTED(); } void diff --git a/chrome/src/nsChromeRegistryContent.h b/chrome/src/nsChromeRegistryContent.h index 06421aa562b..09f81735d0b 100644 --- a/chrome/src/nsChromeRegistryContent.h +++ b/chrome/src/nsChromeRegistryContent.h @@ -89,7 +89,7 @@ class nsChromeRegistryContent : public nsChromeRegistry void RegisterResource(const ResourceMapping& aResource); void RegisterOverride(const OverrideMapping& aOverride); - NS_OVERRIDE void UpdateSelectedLocale(); + NS_OVERRIDE nsresult UpdateSelectedLocale(); NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, const nsCString& aProvider, const nsCString& aPath);