|
| 1 | +diff --git a/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp b/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp |
| 2 | +index cbd32cefe0..16df1ec5a0 100644 |
| 3 | +--- a/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp |
| 4 | ++++ b/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp |
| 5 | +@@ -502,6 +502,12 @@ static std::tuple<String, Vector<char16_t, 32>> retrieveTimeZoneInformation() |
| 6 | + getTimeZoneOverride(timeZoneID); |
| 7 | + String canonical; |
| 8 | + UErrorCode status = U_ZERO_ERROR; |
| 9 | ++#if (defined(UCONFIG_NO_FORMATTING) && UCONFIG_NO_FORMATTING) || !defined(ucal_getCanonicalTimeZoneID) |
| 10 | ++ if (!timeZoneID.isEmpty()) |
| 11 | ++ canonical = String(timeZoneID.span()); |
| 12 | ++ else |
| 13 | ++ canonical = "UTC"_s; |
| 14 | ++#else |
| 15 | + if (timeZoneID.isEmpty()) { |
| 16 | + status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID); |
| 17 | + ASSERT_UNUSED(status, U_SUCCESS(status)); |
| 18 | +@@ -514,6 +520,7 @@ static std::tuple<String, Vector<char16_t, 32>> retrieveTimeZoneInformation() |
| 19 | + } |
| 20 | + if (canonical.isNull() || isUTCEquivalent(canonical)) |
| 21 | + canonical = "UTC"_s; |
| 22 | ++#endif |
| 23 | + |
| 24 | + globalCache.get() = std::tuple { canonical.isolatedCopy(), WTFMove(timeZoneID), currentID }; |
| 25 | + } |
| 26 | +diff --git a/webkit/Source/WTF/wtf/DateMath.cpp b/webkit/Source/WTF/wtf/DateMath.cpp |
| 27 | +index d4551c78ef..37b2ef6fc2 100644 |
| 28 | +--- a/webkit/Source/WTF/wtf/DateMath.cpp |
| 29 | ++++ b/webkit/Source/WTF/wtf/DateMath.cpp |
| 30 | +@@ -1008,6 +1008,10 @@ String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u |
| 31 | + |
| 32 | + static std::optional<Vector<char16_t, 32>> validateTimeZone(StringView timeZone) |
| 33 | + { |
| 34 | ++#if defined(UCONFIG_NO_FORMATTING) && UCONFIG_NO_FORMATTING |
| 35 | ++ UNUSED_PARAM(timeZone); |
| 36 | ++ return std::nullopt; |
| 37 | ++#else |
| 38 | + auto buffer = timeZone.upconvertedCharacters(); |
| 39 | + const char16_t* characters = buffer; |
| 40 | + Vector<char16_t, 32> canonicalBuffer; |
| 41 | +@@ -1015,6 +1019,7 @@ static std::optional<Vector<char16_t, 32>> validateTimeZone(StringView timeZone) |
| 42 | + if (!U_SUCCESS(status)) |
| 43 | + return std::nullopt; |
| 44 | + return canonicalBuffer; |
| 45 | ++#endif |
| 46 | + } |
| 47 | + |
| 48 | + bool isTimeZoneValid(StringView timeZone) |
0 commit comments