mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 06:38:36 +00:00
Back out changeset d9c4a4d5a4e4 (bug 441167)
This commit is contained in:
parent
e01887b2a7
commit
c15f54734f
@ -46,7 +46,6 @@
|
||||
#include "nsIScriptableDateFormat.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
static NS_DEFINE_CID(kLocaleServiceCID, NS_LOCALESERVICE_CID);
|
||||
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
@ -115,19 +114,14 @@ NS_IMETHODIMP nsScriptableDateFormat::FormatDateTime(
|
||||
|
||||
nsCOMPtr<nsILocale> locale;
|
||||
// re-initialise locale pointer only if the locale was given explicitly
|
||||
if (localeName.IsEmpty()) {
|
||||
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
|
||||
if (!localeName.IsEmpty()) {
|
||||
// get locale service
|
||||
nsCOMPtr<nsILocaleService> localeService(do_GetService(kLocaleServiceCID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// get locale
|
||||
rv = localeService->NewLocale(localeName, getter_AddRefs(locale));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCString cLocaleName;
|
||||
rv = prefs->GetCharPref("general.useragent.locale", getter_Copies(cLocaleName));
|
||||
CopyUTF8toUTF16(cLocaleName, localeName);
|
||||
}
|
||||
// get locale service
|
||||
nsCOMPtr<nsILocaleService> localeService(do_GetService(kLocaleServiceCID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// get locale
|
||||
rv = localeService->NewLocale(localeName, getter_AddRefs(locale));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIDateTimeFormat> dateTimeFormat(do_CreateInstance(kDateTimeFormatCID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user