From 0d2aefce153f0e6b5b32ec33229b6e9241c653c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 23 Sep 2021 10:51:58 +0000 Subject: [PATCH] Bug 1731620 - Part 5: Use ICU for jsdate even when MOZ_SYSTEM_ICU is set. r=platform-i18n-reviewers,gregtatum Now that `DateTime` works even when `MOZ_SYSTEM_ICU` is set, we no longer have to check for `MOZ_SYSTEM_ICU` in "jsdate.cpp". This also allows to remove the `MOZ_SYSTEM_ICU` checks in "vm/Time", because those were only called from "jsdate.cpp" when `MOZ_SYSTEM_ICU` was set. Differential Revision: https://phabricator.services.mozilla.com/D126195 --- js/src/jsdate.cpp | 12 ++++++------ js/src/vm/Time.cpp | 4 ++-- js/src/vm/Time.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index f8f7abe17ce3..8bf86ac057f2 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -137,7 +137,7 @@ namespace { class DateTimeHelper { private: -#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU +#if JS_HAS_INTL_API static double localTZA(double t, DateTimeInfo::TimeZoneOffset offset); #else static int equivalentYearForDST(int year); @@ -152,7 +152,7 @@ class DateTimeHelper { static double UTC(double t); static JSString* timeZoneComment(JSContext* cx, double utcTime, double localTime); -#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU +#if !JS_HAS_INTL_API static size_t formatTime(char* buf, size_t buflen, const char* fmt, double utcTime, double localTime); #endif @@ -447,7 +447,7 @@ JS_PUBLIC_API void JS::SetTimeResolutionUsec(uint32_t resolution, bool jitter) { sJitter = jitter; } -#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU +#if JS_HAS_INTL_API // ES2019 draft rev 0ceb728a1adbffe42b26972a6541fd7f398b1557 // 20.3.1.7 LocalTZA ( t, isUTC ) double DateTimeHelper::localTZA(double t, DateTimeInfo::TimeZoneOffset offset) { @@ -569,7 +569,7 @@ double DateTimeHelper::UTC(double t) { return t - adjustTime(t - DateTimeInfo::localTZA() - msPerHour); } -#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */ +#endif /* JS_HAS_INTL_API */ static double LocalTime(double t) { return DateTimeHelper::localTime(t); } @@ -2810,7 +2810,7 @@ static bool date_toJSON(JSContext* cx, unsigned argc, Value* vp) { return Call(cx, toISO, obj, args.rval()); } -#if JS_HAS_INTL_API && !MOZ_SYSTEM_ICU +#if JS_HAS_INTL_API JSString* DateTimeHelper::timeZoneComment(JSContext* cx, double utcTime, double localTime) { const char* locale = cx->runtime()->getDefaultLocale(); @@ -2914,7 +2914,7 @@ JSString* DateTimeHelper::timeZoneComment(JSContext* cx, double utcTime, return cx->names().empty; } -#endif /* JS_HAS_INTL_API && !MOZ_SYSTEM_ICU */ +#endif /* JS_HAS_INTL_API */ static JSString* TimeZoneComment(JSContext* cx, double utcTime, double localTime) { diff --git a/js/src/vm/Time.cpp b/js/src/vm/Time.cpp index ff769db435ae..4ccc561f487c 100644 --- a/js/src/vm/Time.cpp +++ b/js/src/vm/Time.cpp @@ -233,7 +233,7 @@ static int64_t PRMJ_Now() { } #endif -#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU +#if !JS_HAS_INTL_API # ifdef XP_WIN static void PRMJ_InvalidParameterHandler(const wchar_t* expression, const wchar_t* function, @@ -381,4 +381,4 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt, # endif return result; } -#endif /* !JS_HAS_INTL_API || MOZ_SYSTEM_ICU */ +#endif /* !JS_HAS_INTL_API */ diff --git a/js/src/vm/Time.h b/js/src/vm/Time.h index bf8949d5b4e3..3603c856ad2a 100644 --- a/js/src/vm/Time.h +++ b/js/src/vm/Time.h @@ -12,7 +12,7 @@ #include #include -#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU +#if !JS_HAS_INTL_API /* * Broken down form of 64 bit time value. */ @@ -51,7 +51,7 @@ extern void PRMJ_NowShutdown(); inline void PRMJ_NowShutdown() {} #endif -#if !JS_HAS_INTL_API || MOZ_SYSTEM_ICU +#if !JS_HAS_INTL_API /* Format a time value into a buffer. Same semantics as strftime() */ extern size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt, const PRMJTime* tm, int timeZoneYear,