Diff
Modified: trunk/JSTests/ChangeLog (293624 => 293625)
--- trunk/JSTests/ChangeLog 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/JSTests/ChangeLog 2022-04-29 18:55:21 UTC (rev 293625)
@@ -1,3 +1,19 @@
+2022-04-29 Yury Semikhatsky <[email protected]>
+
+ Format time zone name using ICU instead of platform calls
+ https://bugs.webkit.org/show_bug.cgi?id=239865
+
+ Reviewed by Yusuke Suzuki.
+
+ Added new tests that ensure Date's timezone is formatted using preferred
+ language.
+
+ * complex.yaml:
+ * complex/timezone-format-de.js: Added.
+ (shouldBe):
+ * complex/timezone-format-en.js: Added.
+ (shouldBe):
+
2022-04-27 Angelos Oikonomopoulos <[email protected]>
Unskip flaky test on mips
Added: trunk/JSTests/complex/timezone-format-de.js (0 => 293625)
--- trunk/JSTests/complex/timezone-format-de.js (rev 0)
+++ trunk/JSTests/complex/timezone-format-de.js 2022-04-29 18:55:21 UTC (rev 293625)
@@ -0,0 +1,15 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+// Thu Apr 28 2022 14:42:34 GMT-0700 (Pacific Daylight Time)
+const date1 = new Date(1651182154000);
+$vm.setUserPreferredLanguages(['de-DE']);
+shouldBe(date1.toString(), 'Thu Apr 28 2022 23:42:34 GMT+0200 (Mitteleuropäische Sommerzeit)');
+shouldBe(date1.toTimeString(), '23:42:34 GMT+0200 (Mitteleuropäische Sommerzeit)');
+
+// Tue Jan 18 2022 13:42:34 GMT-0800 (Pacific Standard Time)
+const date2 = new Date(1642542154000);
+shouldBe(date2.toString(), 'Tue Jan 18 2022 22:42:34 GMT+0100 (Mitteleuropäische Normalzeit)');
+shouldBe(date2.toTimeString(), '22:42:34 GMT+0100 (Mitteleuropäische Normalzeit)');
Added: trunk/JSTests/complex/timezone-format-en.js (0 => 293625)
--- trunk/JSTests/complex/timezone-format-en.js (rev 0)
+++ trunk/JSTests/complex/timezone-format-en.js 2022-04-29 18:55:21 UTC (rev 293625)
@@ -0,0 +1,15 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+// Thu Apr 28 2022 14:42:34 GMT-0700 (Pacific Daylight Time)
+const date1 = new Date(1651182154000);
+$vm.setUserPreferredLanguages(['en-US']);
+shouldBe(date1.toString(), 'Thu Apr 28 2022 17:42:34 GMT-0400 (Eastern Daylight Time)');
+shouldBe(date1.toTimeString(), '17:42:34 GMT-0400 (Eastern Daylight Time)');
+
+// Tue Jan 18 2022 13:42:34 GMT-0800 (Pacific Standard Time)
+const date2 = new Date(1642542154000);
+shouldBe(date2.toString(), 'Tue Jan 18 2022 16:42:34 GMT-0500 (Eastern Standard Time)');
+shouldBe(date2.toTimeString(), '16:42:34 GMT-0500 (Eastern Standard Time)');
Modified: trunk/JSTests/complex.yaml (293624 => 293625)
--- trunk/JSTests/complex.yaml 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/JSTests/complex.yaml 2022-04-29 18:55:21 UTC (rev 293625)
@@ -29,6 +29,12 @@
- path: complex/tagged-template-regeneration.js
cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], "", "--useDollarVM=1"
+- path: complex/timezone-format-de.js
+ cmd: runComplexTest [], [], "TZ=Europe/Berlin", "--useDollarVM=1"
+
+- path: complex/timezone-format-en.js
+ cmd: runComplexTest [], [], "TZ=America/New_York", "--useDollarVM=1"
+
- path: complex/timezone-offset-apia.js
cmd: runComplexTest [], [], "TZ=Pacific/Apia", "--useDollarVM=1"
Modified: trunk/LayoutTests/ChangeLog (293624 => 293625)
--- trunk/LayoutTests/ChangeLog 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/ChangeLog 2022-04-29 18:55:21 UTC (rev 293625)
@@ -1,3 +1,20 @@
+2022-04-29 Yury Semikhatsky <[email protected]>
+
+ Format time zone name using ICU instead of platform calls
+ https://bugs.webkit.org/show_bug.cgi?id=239865
+
+ Reviewed by Yusuke Suzuki.
+
+ Rebased existing layout tests to reflect new format (which is the same as in other
+ browsers now).
+
+ * storage/indexeddb/modern/date-basic-expected.txt:
+ * storage/indexeddb/modern/date-basic-private-expected.txt:
+ * storage/indexeddb/modern/get-keyrange-expected.txt:
+ * storage/indexeddb/modern/get-keyrange-private-expected.txt:
+ * storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt:
+ * storage/indexeddb/modern/idbobjectstore-delete-1-private-expected.txt:
+
2022-04-29 Arcady Goldmints-Orlov <[email protected]>
REGRESSION(r291998): [GTK] test accessibility/gtk/menu-list-unfocused-notifications.html is flaky
Modified: trunk/LayoutTests/inspector/model/remote-object/date-expected.txt (293624 => 293625)
--- trunk/LayoutTests/inspector/model/remote-object/date-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/inspector/model/remote-object/date-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -5,11 +5,11 @@
"_type": "object",
"_subtype": "date",
"_objectId": "<filtered>",
- "_description": "Wed Dec 31 1969 16:00:00 GMT-0800 (PST)",
+ "_description": "Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)",
"_preview": {
"_type": "object",
"_subtype": "date",
- "_description": "Wed Dec 31 1969 16:00:00 GMT-0800 (PST)",
+ "_description": "Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)",
"_lossless": false,
"_overflow": false,
"_properties": [],
@@ -23,11 +23,11 @@
"_type": "object",
"_subtype": "date",
"_objectId": "<filtered>",
- "_description": "Wed Jan 21 2015 21:07:25 GMT-0800 (PST)",
+ "_description": "Wed Jan 21 2015 21:07:25 GMT-0800 (Pacific Standard Time)",
"_preview": {
"_type": "object",
"_subtype": "date",
- "_description": "Wed Jan 21 2015 21:07:25 GMT-0800 (PST)",
+ "_description": "Wed Jan 21 2015 21:07:25 GMT-0800 (Pacific Standard Time)",
"_lossless": false,
"_overflow": false,
"_properties": [],
Modified: trunk/LayoutTests/inspector/unit-tests/cookie-expected.txt (293624 => 293625)
--- trunk/LayoutTests/inspector/unit-tests/cookie-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/inspector/unit-tests/cookie-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -188,7 +188,7 @@
PASS: cookie.type should be WI.Cookie.Type.Response.
PASS: cookie.name should be 'name'.
PASS: cookie.value should be 'value'.
-PASS: cookie.expires should be 'Thu Oct 05 2017 20:20:27 GMT-0700 (PDT)'.
+PASS: cookie.expires should be 'Thu Oct 05 2017 20:20:27 GMT-0700 (Pacific Daylight Time)'.
PASS: cookie.maxAge should be '3600'.
PASS: cookie.path should be 'null'.
PASS: cookie.domain should be 'null'.
@@ -202,7 +202,7 @@
PASS: cookie.type should be WI.Cookie.Type.Response.
PASS: cookie.name should be 'name'.
PASS: cookie.value should be 'value'.
-PASS: cookie.expires should be 'Thu Oct 05 2017 20:43:47 GMT-0700 (PDT)'.
+PASS: cookie.expires should be 'Thu Oct 05 2017 20:43:47 GMT-0700 (Pacific Daylight Time)'.
PASS: cookie.maxAge should be '5000'.
PASS: cookie.path should be '/foo'.
PASS: cookie.domain should be 'example.com'.
@@ -260,7 +260,7 @@
PASS: cookie.type should be WI.Cookie.Type.Response.
PASS: cookie.name should be 'name'.
PASS: cookie.value should be '=value='.
-PASS: cookie.expires should be 'Tue Apr 03 2018 20:34:02 GMT-0700 (PDT)'.
+PASS: cookie.expires should be 'Tue Apr 03 2018 20:34:02 GMT-0700 (Pacific Daylight Time)'.
PASS: cookie.maxAge should be 'null'.
PASS: cookie.path should be 'null'.
PASS: cookie.domain should be '.example.com'.
Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-valueasdate-expected.txt (293624 => 293625)
--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-valueasdate-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/input-valueasdate-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -7,27 +7,27 @@
PASS valueAsDate getter on type date (with value: "2019-12-00")
PASS valueAsDate getter on type date (with value: "2019-13-10")
PASS valueAsDate getter on type date (with value: "2019-02-29")
-FAIL valueAsDate getter on type date (with value: "2019-12-10") assert_equals: expected object "Mon Dec 09 2019 16:00:00 GMT-0800 (PST)" but got null
-FAIL valueAsDate getter on type date (with value: "2016-02-29") assert_equals: expected object "Sun Feb 28 2016 16:00:00 GMT-0800 (PST)" but got null
+FAIL valueAsDate getter on type date (with value: "2019-12-10") assert_equals: expected object "Mon Dec 09 2019 16:00:00 GMT-0800 (Pacific Standard Time)" but got null
+FAIL valueAsDate getter on type date (with value: "2016-02-29") assert_equals: expected object "Sun Feb 28 2016 16:00:00 GMT-0800 (Pacific Standard Time)" but got null
FAIL valueAsDate setter on type date (new Date("2019-12-10T00:00:00.000Z")) The object is in an invalid state.
FAIL valueAsDate setter on type date (new Date("2016-02-29T00:00:00.000Z")) The object is in an invalid state.
PASS valueAsDate getter on type month (with value: "")
PASS valueAsDate getter on type month (with value: "0000-12")
PASS valueAsDate getter on type month (with value: "2019-00")
-FAIL valueAsDate getter on type month (with value: "2019-12") assert_equals: expected object "Sat Nov 30 2019 16:00:00 GMT-0800 (PST)" but got null
+FAIL valueAsDate getter on type month (with value: "2019-12") assert_equals: expected object "Sat Nov 30 2019 16:00:00 GMT-0800 (Pacific Standard Time)" but got null
FAIL valueAsDate setter on type month (new Date("2019-12-01T00:00:00.000Z")) The object is in an invalid state.
PASS valueAsDate getter on type week (with value: "")
PASS valueAsDate getter on type week (with value: "0000-W50")
PASS valueAsDate getter on type week (with value: "2019-W00")
PASS valueAsDate getter on type week (with value: "2019-W60")
-FAIL valueAsDate getter on type week (with value: "2019-W50") assert_equals: expected object "Sun Dec 08 2019 16:00:00 GMT-0800 (PST)" but got null
+FAIL valueAsDate getter on type week (with value: "2019-W50") assert_equals: expected object "Sun Dec 08 2019 16:00:00 GMT-0800 (Pacific Standard Time)" but got null
FAIL valueAsDate setter on type week (new Date("2019-12-09T00:00:00.000Z")) The object is in an invalid state.
PASS valueAsDate getter on type time (with value: "")
PASS valueAsDate getter on type time (with value: "24:00")
PASS valueAsDate getter on type time (with value: "00:60")
-FAIL valueAsDate getter on type time (with value: "00:00") assert_equals: expected object "Wed Dec 31 1969 16:00:00 GMT-0800 (PST)" but got null
-FAIL valueAsDate getter on type time (with value: "12:00") assert_equals: expected object "Thu Jan 01 1970 04:00:00 GMT-0800 (PST)" but got null
-FAIL valueAsDate getter on type time (with value: "23:59") assert_equals: expected object "Thu Jan 01 1970 15:59:00 GMT-0800 (PST)" but got null
+FAIL valueAsDate getter on type time (with value: "00:00") assert_equals: expected object "Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)" but got null
+FAIL valueAsDate getter on type time (with value: "12:00") assert_equals: expected object "Thu Jan 01 1970 04:00:00 GMT-0800 (Pacific Standard Time)" but got null
+FAIL valueAsDate getter on type time (with value: "23:59") assert_equals: expected object "Thu Jan 01 1970 15:59:00 GMT-0800 (Pacific Standard Time)" but got null
FAIL valueAsDate setter on type time (new Date("1970-01-01T00:00:00.000Z")) The object is in an invalid state.
FAIL valueAsDate setter on type time (new Date("1970-01-01T12:00:00.000Z")) The object is in an invalid state.
FAIL valueAsDate setter on type time (new Date("1970-01-01T23:59:00.000Z")) The object is in an invalid state.
Modified: trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -9,17 +9,17 @@
indexedDB.open(dbname)
Initial upgrade needed: Old version - 0 New version - 1
Initial upgrade versionchange transaction complete
-Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time)' of type object, result is 'Flux capacitor' of type string
Key is a Date object, btw
-Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
+Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (Pacific Standard Time)' of type object, result is 'Fish under the sea' of type string
Key is a Date object, btw
-Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
+Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time)' of type object, result is 'Hoverboards' of type string
Key is a Date object, btw
-Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time)' of type object
Result is a Date object, btw
-Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
+Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (Pacific Standard Time)' of type object
Result is a Date object, btw
-Success getting key 'c' of type string, result is 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object
+Success getting key 'c' of type string, result is 'Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time)' of type object
Result is a Date object, btw
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-private-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -9,17 +9,17 @@
indexedDB.open(dbname)
Initial upgrade needed: Old version - 0 New version - 1
Initial upgrade versionchange transaction complete
-Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object, result is 'Flux capacitor' of type string
+Success getting key 'Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time)' of type object, result is 'Flux capacitor' of type string
Key is a Date object, btw
-Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
+Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (Pacific Standard Time)' of type object, result is 'Fish under the sea' of type string
Key is a Date object, btw
-Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
+Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time)' of type object, result is 'Hoverboards' of type string
Key is a Date object, btw
-Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (PST)' of type object
+Success getting key 'a' of type string, result is 'Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time)' of type object
Result is a Date object, btw
-Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
+Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (Pacific Standard Time)' of type object
Result is a Date object, btw
-Success getting key 'c' of type string, result is 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object
+Success getting key 'c' of type string, result is 'Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time)' of type object
Result is a Date object, btw
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -123,13 +123,13 @@
Result is PosInf
Success getting keyRange [Infinity (Open), a (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Closed)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Closed)]
Result is Fish under the sea
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Open)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-private-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -123,13 +123,13 @@
Result is PosInf
Success getting keyRange [Infinity (Open), a (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Closed)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Closed)]
Result is Fish under the sea
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Open)]
Result is Flux capacitor
-Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (PST) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+Success getting keyRange [Fri Nov 04 1955 16:00:00 GMT-0800 (Pacific Standard Time) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (Pacific Daylight Time) (Open)]
Result is Fish under the sea
readonly transaction complete
PASS successfullyParsed is true
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -10,9 +10,9 @@
Initial upgrade needed: Old version - 0 New version - 1
Count is 113
Initial upgrade versionchange transaction complete
-Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 1 less things total.
+Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (Pacific Standard Time)", and there should now be 1 less things total.
Count is 112
-Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 0 less things total.
+Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (Pacific Standard Time)", and there should now be 0 less things total.
Count is 112
Deleted "balyhoo", and there should now be 0 less things total.
Count is 112
Modified: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-private-expected.txt (293624 => 293625)
--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-private-expected.txt 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-private-expected.txt 2022-04-29 18:55:21 UTC (rev 293625)
@@ -10,9 +10,9 @@
Initial upgrade needed: Old version - 0 New version - 1
Count is 113
Initial upgrade versionchange transaction complete
-Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 1 less things total.
+Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (Pacific Standard Time)", and there should now be 1 less things total.
Count is 112
-Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 0 less things total.
+Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (Pacific Standard Time)", and there should now be 0 less things total.
Count is 112
Deleted "balyhoo", and there should now be 0 less things total.
Count is 112
Modified: trunk/Source/_javascript_Core/API/tests/testapi.c (293624 => 293625)
--- trunk/Source/_javascript_Core/API/tests/testapi.c 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/API/tests/testapi.c 2022-04-29 18:55:21 UTC (rev 293625)
@@ -1908,7 +1908,7 @@
JSValueRef argumentsDateValues[] = { JSValueMakeNumber(context, 0) };
o = JSObjectMakeDate(context, 1, argumentsDateValues, NULL);
if (timeZoneIsPST())
- assertEqualsAsUTF8String(o, "Wed Dec 31 1969 16:00:00 GMT-0800 (PST)");
+ assertEqualsAsUTF8String(o, "Wed Dec 31 1969 16:00:00 GMT-0800 (Pacific Standard Time)");
string = JSStringCreateWithUTF8CString("an error message");
JSValueRef argumentsErrorValues[] = { JSValueMakeString(context, string) };
Modified: trunk/Source/_javascript_Core/ChangeLog (293624 => 293625)
--- trunk/Source/_javascript_Core/ChangeLog 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-04-29 18:55:21 UTC (rev 293625)
@@ -1,3 +1,31 @@
+2022-04-29 Yury Semikhatsky <[email protected]>
+
+ Format time zone name using ICU instead of platform calls
+ https://bugs.webkit.org/show_bug.cgi?id=239865
+
+ Reviewed by Yusuke Suzuki.
+
+ formatDateTime now uses cached display name of the timezone.
+
+ * runtime/DateConstructor.cpp:
+ (JSC::JSC_DEFINE_HOST_FUNCTION):
+ * runtime/DateConversion.cpp:
+ (JSC::formatDateTime):
+ * runtime/DateConversion.h:
+ * runtime/DatePrototype.cpp:
+ (JSC::formateDateInstance):
+ * runtime/JSDateMath.cpp:
+ (JSC::toICUTimeZone): Encapsulate bitwise_cast into typesafe functions.
+ (JSC::toOpaqueICUTimeZone):
+ (JSC::OpaqueICUTimeZoneDeleter::operator()):
+ (JSC::DateCache::calculateLocalTimeOffset):
+ (JSC::DateCache::defaultTimeZone):
+ (JSC::DateCache::timeZoneDisplayName): Both standard and daylight names are computed
+ once on the first access as ICU methods internally acquire locks.
+ (JSC::DateCache::timeZoneCacheSlow):
+ (JSC::DateCache::resetIfNecessary):
+ * runtime/JSDateMath.h:
+
2022-04-29 Yusuke Suzuki <[email protected]>
Unreviewed, remove unused variable
Modified: trunk/Source/_javascript_Core/runtime/DateConstructor.cpp (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/DateConstructor.cpp 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/DateConstructor.cpp 2022-04-29 18:55:21 UTC (rev 293625)
@@ -150,7 +150,7 @@
VM& vm = globalObject->vm();
GregorianDateTime ts;
vm.dateCache.msToGregorianDateTime(WallTime::now().secondsSinceEpoch().milliseconds(), WTF::LocalTime, ts);
- return JSValue::encode(jsNontrivialString(vm, formatDateTime(ts, DateTimeFormatDateAndTime, false)));
+ return JSValue::encode(jsNontrivialString(vm, formatDateTime(ts, DateTimeFormatDateAndTime, false, vm.dateCache)));
}
JSC_DEFINE_HOST_FUNCTION(dateParse, (JSGlobalObject* globalObject, CallFrame* callFrame))
Modified: trunk/Source/_javascript_Core/runtime/DateConversion.cpp (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/DateConversion.cpp 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/DateConversion.cpp 2022-04-29 18:55:21 UTC (rev 293625)
@@ -30,10 +30,6 @@
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
-#if OS(WINDOWS)
-#include <windows.h>
-#endif
-
namespace JSC {
template<int width>
@@ -58,7 +54,7 @@
builder.append(static_cast<char>('0' + value % 10));
}
-String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool asUTCVariant)
+String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool asUTCVariant, DateCache& dateCache)
{
bool appendDate = format & DateTimeFormatDate;
bool appendTime = format & DateTimeFormatTime;
@@ -96,18 +92,8 @@
builder.append(t.utcOffsetInMinute() < 0 ? '-' : '+');
appendNumber<2>(builder, offset / 60);
appendNumber<2>(builder, offset % 60);
-
-#if OS(WINDOWS)
- TIME_ZONE_INFORMATION timeZoneInformation;
- GetTimeZoneInformation(&timeZoneInformation);
- const WCHAR* winTimeZoneName = t.isDST() ? timeZoneInformation.DaylightName : timeZoneInformation.StandardName;
- String timeZoneName(winTimeZoneName);
-#else
- struct tm gtm = t;
- char timeZoneName[70];
- strftime(timeZoneName, sizeof(timeZoneName), "%Z", >m);
-#endif
- if (timeZoneName[0])
+ String timeZoneName = dateCache.timeZoneDisplayName(t.isDST());
+ if (!timeZoneName.isEmpty())
builder.append(" (", timeZoneName, ')');
}
}
Modified: trunk/Source/_javascript_Core/runtime/DateConversion.h (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/DateConversion.h 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/DateConversion.h 2022-04-29 18:55:21 UTC (rev 293625)
@@ -29,6 +29,8 @@
namespace JSC {
+class DateCache;
+
enum DateTimeFormat {
DateTimeFormatDate = 1,
DateTimeFormatTime = 2,
@@ -35,6 +37,6 @@
DateTimeFormatDateAndTime = DateTimeFormatDate | DateTimeFormatTime
};
-JS_EXPORT_PRIVATE WTF::String formatDateTime(const GregorianDateTime&, DateTimeFormat, bool asUTCVariant);
+JS_EXPORT_PRIVATE WTF::String formatDateTime(const GregorianDateTime&, DateTimeFormat, bool asUTCVariant, DateCache&);
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/DatePrototype.cpp (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/DatePrototype.cpp 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/DatePrototype.cpp 2022-04-29 18:55:21 UTC (rev 293625)
@@ -106,7 +106,7 @@
if (!gregorianDateTime)
return JSValue::encode(jsNontrivialString(vm, String("Invalid Date"_s)));
- return JSValue::encode(jsNontrivialString(vm, formatDateTime(*gregorianDateTime, format, asUTCVariant)));
+ return JSValue::encode(jsNontrivialString(vm, formatDateTime(*gregorianDateTime, format, asUTCVariant, cache)));
}
Modified: trunk/Source/_javascript_Core/runtime/JSDateMath.cpp (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/JSDateMath.cpp 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/JSDateMath.cpp 2022-04-29 18:55:21 UTC (rev 293625)
@@ -75,6 +75,7 @@
#include "ExceptionHelpers.h"
#include "VM.h"
#include <limits>
+#include <wtf/Language.h>
#include <wtf/unicode/icu/ICUHelpers.h>
#if U_ICU_VERSION_MAJOR_NUM >= 69 || (U_ICU_VERSION_MAJOR_NUM == 68 && USE(APPLE_INTERNAL_SDK))
@@ -89,6 +90,7 @@
#undef U_SHOW_CPLUSPLUS_API
#define U_SHOW_CPLUSPLUS_API 1
#include <unicode/basictz.h>
+#include <unicode/locid.h>
#include <unicode/timezone.h>
#include <unicode/unistr.h>
#undef U_SHOW_CPLUSPLUS_API
@@ -108,6 +110,15 @@
std::unique_ptr<UCalendar, ICUDeleter<ucal_close>> m_calendar;
String m_canonicalTimeZoneID;
};
+#else
+static icu::TimeZone* toICUTimeZone(OpaqueICUTimeZone* timeZone)
+{
+ return bitwise_cast<icu::TimeZone*>(timeZone);
+}
+static OpaqueICUTimeZone* toOpaqueICUTimeZone(icu::TimeZone* timeZone)
+{
+ return bitwise_cast<OpaqueICUTimeZone*>(timeZone);
+}
#endif
void OpaqueICUTimeZoneDeleter::operator()(OpaqueICUTimeZone* timeZone)
@@ -116,7 +127,7 @@
#if HAVE(ICU_C_TIMEZONE_API)
delete timeZone;
#else
- delete bitwise_cast<icu::TimeZone*>(timeZone);
+ delete toICUTimeZone(timeZone);
#endif
}
}
@@ -155,7 +166,7 @@
return failed;
}
#else
- auto& timeZoneCache = *bitwise_cast<icu::TimeZone*>(this->timeZoneCache());
+ auto& timeZoneCache = *toICUTimeZone(this->timeZoneCache());
if (inputTimeType != WTF::LocalTime) {
constexpr bool isLocalTime = false;
timeZoneCache.getOffset(millisecondsFromEpoch, isLocalTime, rawOffset, dstOffset, status);
@@ -337,7 +348,7 @@
#else
icu::UnicodeString timeZoneID;
icu::UnicodeString canonicalTimeZoneID;
- auto& timeZone = *bitwise_cast<icu::TimeZone*>(timeZoneCache());
+ auto& timeZone = *toICUTimeZone(timeZoneCache());
timeZone.getID(timeZoneID);
UErrorCode status = U_ZERO_ERROR;
@@ -354,6 +365,46 @@
#endif
}
+String DateCache::timeZoneDisplayName(bool isDST)
+{
+ if (m_timeZoneStandardDisplayNameCache.isNull()) {
+#if HAVE(ICU_C_TIMEZONE_API)
+ auto& timeZoneCache = *this->timeZoneCache();
+ String languageString = defaultLanguage();
+ const char* language = languageString.utf8().data();
+ {
+ Vector<UChar, 32> standardDisplayNameBuffer;
+ auto status = callBufferProducingFunction(ucal_getTimeZoneDisplayName, timeZoneCache.m_calendar.get(), UCAL_STANDARD, language, standardDisplayNameBuffer);
+ if (U_SUCCESS(status))
+ m_timeZoneStandardDisplayNameCache = String::adopt(WTFMove(standardDisplayNameBuffer));
+ }
+ {
+ Vector<UChar, 32> dstDisplayNameBuffer;
+ auto status = callBufferProducingFunction(ucal_getTimeZoneDisplayName, timeZoneCache.m_calendar.get(), UCAL_DST, language, dstDisplayNameBuffer);
+ if (U_SUCCESS(status))
+ m_timeZoneDSTDisplayNameCache = String::adopt(WTFMove(dstDisplayNameBuffer));
+ }
+#else
+ auto& timeZoneCache = *toICUTimeZone(this->timeZoneCache());
+ String language = defaultLanguage();
+ icu::Locale locale(language.utf8().data());
+ {
+ icu::UnicodeString standardDisplayName;
+ timeZoneCache.getDisplayName(false /* inDaylight */, icu::TimeZone::LONG, locale, standardDisplayName);
+ m_timeZoneStandardDisplayNameCache = String(standardDisplayName.getBuffer(), standardDisplayName.length());
+ }
+ {
+ icu::UnicodeString dstDisplayName;
+ timeZoneCache.getDisplayName(true /* inDaylight */, icu::TimeZone::LONG, locale, dstDisplayName);
+ m_timeZoneDSTDisplayNameCache = String(dstDisplayName.getBuffer(), dstDisplayName.length());
+ }
+#endif
+ }
+ if (isDST)
+ return m_timeZoneDSTDisplayNameCache;
+ return m_timeZoneStandardDisplayNameCache;
+}
+
#if PLATFORM(COCOA)
static void timeZoneChangeNotification(CFNotificationCenterRef, void*, CFStringRef, const void*, CFDictionaryRef)
{
@@ -406,7 +457,7 @@
m_timeZoneCache = std::unique_ptr<OpaqueICUTimeZone, OpaqueICUTimeZoneDeleter>(cache);
#else
// Do not use icu::TimeZone::createDefault. ICU internally has a cache for timezone and createDefault returns this cached value.
- m_timeZoneCache = std::unique_ptr<OpaqueICUTimeZone, OpaqueICUTimeZoneDeleter>(bitwise_cast<OpaqueICUTimeZone*>(icu::TimeZone::detectHostTimeZone()));
+ m_timeZoneCache = std::unique_ptr<OpaqueICUTimeZone, OpaqueICUTimeZoneDeleter>(toOpaqueICUTimeZone(icu::TimeZone::detectHostTimeZone()));
#endif
}
@@ -426,6 +477,8 @@
m_cachedDateString = String();
m_cachedDateStringValue = std::numeric_limits<double>::quiet_NaN();
m_dateInstanceCache.reset();
+ m_timeZoneStandardDisplayNameCache = String();
+ m_timeZoneDSTDisplayNameCache = String();
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/runtime/JSDateMath.h (293624 => 293625)
--- trunk/Source/_javascript_Core/runtime/JSDateMath.h 2022-04-29 18:13:02 UTC (rev 293624)
+++ trunk/Source/_javascript_Core/runtime/JSDateMath.h 2022-04-29 18:55:21 UTC (rev 293625)
@@ -80,7 +80,7 @@
JS_EXPORT_PRIVATE void resetIfNecessary();
String defaultTimeZone();
-
+ String timeZoneDisplayName(bool isDST);
Ref<DateInstanceData> cachedDateInstanceData(double millisecondsFromEpoch);
void msToGregorianDateTime(double millisecondsFromEpoch, WTF::TimeType outputTimeType, GregorianDateTime&);
@@ -108,6 +108,8 @@
double m_cachedDateStringValue;
DateInstanceCache m_dateInstanceCache;
uint64_t m_cachedTimezoneID { 0 };
+ String m_timeZoneStandardDisplayNameCache;
+ String m_timeZoneDSTDisplayNameCache;
};
ALWAYS_INLINE bool isUTCEquivalent(StringView timeZone)