From 2755d5e37d7fcb724962aab30d63465857d9bd63 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 22 Apr 2021 23:10:12 +0000 Subject: [PATCH] browser(webkit): fix timezone override on Windows (#6277) --- browser_patches/webkit/BUILD_NUMBER | 4 +-- browser_patches/webkit/patches/bootstrap.diff | 29 +++++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/browser_patches/webkit/BUILD_NUMBER b/browser_patches/webkit/BUILD_NUMBER index 3013a1ba6e..5acce18812 100644 --- a/browser_patches/webkit/BUILD_NUMBER +++ b/browser_patches/webkit/BUILD_NUMBER @@ -1,2 +1,2 @@ -1464 -Changed: yurys@chromium.org Wed 21 Apr 2021 11:35:09 AM PDT +1465 +Changed: yurys@chromium.org Thu, Apr 22, 2021 11:00:54 PM diff --git a/browser_patches/webkit/patches/bootstrap.diff b/browser_patches/webkit/patches/bootstrap.diff index c2c2997b04..737e7aa846 100644 --- a/browser_patches/webkit/patches/bootstrap.diff +++ b/browser_patches/webkit/patches/bootstrap.diff @@ -1425,7 +1425,7 @@ index f89806c56b260522fc7c7b98af852cf733f8985f..0ae692ba821d4a6c5210fe12ce77b84a #include diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp -index ea0bfb0d7a5a64c1570da5333199f99b552a5ff6..3b9bd5729e835e909efdaedc590b28b23e32acf4 100644 +index ea0bfb0d7a5a64c1570da5333199f99b552a5ff6..2ebe8c6c5ac4343e0b373ccc271e86a4080a98dc 100644 --- a/Source/JavaScriptCore/runtime/JSDateMath.cpp +++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp @@ -76,6 +76,7 @@ @@ -1447,21 +1447,38 @@ index ea0bfb0d7a5a64c1570da5333199f99b552a5ff6..3b9bd5729e835e909efdaedc590b28b2 #if HAVE(ICU_C_TIMEZONE_API) auto& timeZone = *timeZoneCache(); Vector buffer; -@@ -382,6 +387,14 @@ Ref DateCache::cachedDateInstanceData(double millisecondsFromE +@@ -382,16 +387,29 @@ Ref DateCache::cachedDateInstanceData(double millisecondsFromE void DateCache::timeZoneCacheSlow() { ASSERT(!m_timeZoneCache); + + String override = WTF::timeZoneForAutomation(); + #if HAVE(ICU_C_TIMEZONE_API) + auto* cache = new OpaqueICUTimeZone; ++ // ucal_open checks that the status is success, so it has to be initialized here. ++ UErrorCode status = U_ZERO_ERROR; + Vector timeZoneID; +- auto status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID); +- ASSERT_UNUSED(status, U_SUCCESS(status)); ++ if (override.isEmpty()) { ++ status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID); ++ ASSERT_UNUSED(status, U_SUCCESS(status)); ++ } else { ++ timeZoneID = override.charactersWithoutNullTermination(); ++ } + cache->m_calendar = std::unique_ptr>(ucal_open(timeZoneID.data(), timeZoneID.size(), "", UCAL_DEFAULT, &status)); + ASSERT_UNUSED(status, U_SUCCESS(status)); + ucal_setGregorianChange(cache->m_calendar.get(), minECMAScriptTime, &status); // Ignore "unsupported" error. + m_timeZoneCache = std::unique_ptr(cache); + #else + if (!override.isEmpty()) { + auto* timezone = icu::TimeZone::createTimeZone(override.utf8().data()); + m_timeZoneCache = std::unique_ptr(bitwise_cast(timezone)); + return; + } -+ - #if HAVE(ICU_C_TIMEZONE_API) - auto* cache = new OpaqueICUTimeZone; - Vector timeZoneID; + // Do not use icu::TimeZone::createDefault. ICU internally has a cache for timezone and createDefault returns this cached value. + m_timeZoneCache = std::unique_ptr(bitwise_cast(icu::TimeZone::detectHostTimeZone())); + #endif diff --git a/Source/ThirdParty/libwebrtc/CMakeLists.txt b/Source/ThirdParty/libwebrtc/CMakeLists.txt index 351db7adbf094984f04bd2fc923420eba7682abe..1744bd94c21838a8d8eb2cce386458ada38514fc 100644 --- a/Source/ThirdParty/libwebrtc/CMakeLists.txt