Title: [252345] trunk
Revision
252345
Author
[email protected]
Date
2019-11-11 16:58:40 -0800 (Mon, 11 Nov 2019)

Log Message

UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
https://bugs.webkit.org/show_bug.cgi?id=204032

Reviewed by Yusuke Suzuki.

JSTests:

* complex.yaml:
* complex/timezone-offset-apia.js: Added.
Add test to verify Date.prototype.getTimezoneOffset for TZ=Pacific/Apia.

Source/WTF:

We have code assuming that the world's time zones haven't changed in the past decade,
but Samoa changed from UTC-11 to UTC+13 at the beginning of 2012.

(Note: "Samoa" here means the Independent State of Samoa (Pacific/Apia) and not American Samoa (Pacific/Samoa).
       See https://en.wikipedia.org/wiki/Time_in_Samoa for more information.)

* wtf/DateMath.cpp:
(WTF::calculateUTCOffset):
Update "canned date" from 2009 to 2019.

Tools:

* Scripts/run-jsc-stress-tests:
Allow environment variables to be passed to "complex" tests.

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (252344 => 252345)


--- trunk/JSTests/ChangeLog	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/JSTests/ChangeLog	2019-11-12 00:58:40 UTC (rev 252345)
@@ -1,3 +1,14 @@
+2019-11-11  Ross Kirsling  <[email protected]>
+
+        UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
+        https://bugs.webkit.org/show_bug.cgi?id=204032
+
+        Reviewed by Yusuke Suzuki.
+
+        * complex.yaml:
+        * complex/timezone-offset-apia.js: Added.
+        Add test to verify Date.prototype.getTimezoneOffset for TZ=Pacific/Apia.
+
 2019-11-08  Guillaume Emont  <[email protected]>
 
         Temporarily skip another broken test on MIPS due to OSR exit to LLInt

Added: trunk/JSTests/complex/timezone-offset-apia.js (0 => 252345)


--- trunk/JSTests/complex/timezone-offset-apia.js	                        (rev 0)
+++ trunk/JSTests/complex/timezone-offset-apia.js	2019-11-12 00:58:40 UTC (rev 252345)
@@ -0,0 +1,7 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+shouldBe(new Date("2019-05-01").getTimezoneOffset() / -60, 13);
+shouldBe(new Date("2019-11-01").getTimezoneOffset() / -60, 14);

Modified: trunk/JSTests/complex.yaml (252344 => 252345)


--- trunk/JSTests/complex.yaml	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/JSTests/complex.yaml	2019-11-12 00:58:40 UTC (rev 252345)
@@ -24,7 +24,10 @@
 # This is for writing a bit complex tests to drive in JSC shell (e.g. including multiple files with some special options).
 
 - path: complex/generator-regeneration.js
-  cmd: runComplexTest [], ["generator-regeneration-after.js"], "--useDollarVM=1"
+  cmd: runComplexTest [], ["generator-regeneration-after.js"], "", "--useDollarVM=1"
 
 - path: complex/tagged-template-regeneration.js
-  cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], "--useDollarVM=1"
+  cmd: runComplexTest [], ["tagged-template-regeneration-after.js"], "", "--useDollarVM=1"
+
+- path: complex/timezone-offset-apia.js
+  cmd: runComplexTest [], [], "TZ=Pacific/Apia", "--useDollarVM=1"

Modified: trunk/Source/WTF/ChangeLog (252344 => 252345)


--- trunk/Source/WTF/ChangeLog	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/Source/WTF/ChangeLog	2019-11-12 00:58:40 UTC (rev 252345)
@@ -1,3 +1,20 @@
+2019-11-11  Ross Kirsling  <[email protected]>
+
+        UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
+        https://bugs.webkit.org/show_bug.cgi?id=204032
+
+        Reviewed by Yusuke Suzuki.
+
+        We have code assuming that the world's time zones haven't changed in the past decade,
+        but Samoa changed from UTC-11 to UTC+13 at the beginning of 2012.
+
+        (Note: "Samoa" here means the Independent State of Samoa (Pacific/Apia) and not American Samoa (Pacific/Samoa).
+               See https://en.wikipedia.org/wiki/Time_in_Samoa for more information.)
+
+        * wtf/DateMath.cpp:
+        (WTF::calculateUTCOffset):
+        Update "canned date" from 2009 to 2019.
+
 2019-11-07  Mark Lam  <[email protected]>
 
         Add a stack overflow check in Yarr::ByteCompiler::emitDisjunction().

Modified: trunk/Source/WTF/wtf/DateMath.cpp (252344 => 252345)


--- trunk/Source/WTF/wtf/DateMath.cpp	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/Source/WTF/wtf/DateMath.cpp	2019-11-12 00:58:40 UTC (rev 252345)
@@ -269,9 +269,9 @@
 #if HAVE(TIMEGM)
     time_t utcOffset = timegm(&localt) - mktime(&localt);
 #else
-    // Using a canned date of 01/01/2009 on platforms with weaker date-handling foo.
-    localt.tm_year = 109;
-    time_t utcOffset = 1230768000 - mktime(&localt);
+    // Using a canned date of 01/01/2019 on platforms with weaker date-handling foo.
+    localt.tm_year = 119;
+    time_t utcOffset = 1546300800 - mktime(&localt);
 #endif
 
     return static_cast<int32_t>(utcOffset * 1000);

Modified: trunk/Tools/ChangeLog (252344 => 252345)


--- trunk/Tools/ChangeLog	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/Tools/ChangeLog	2019-11-12 00:58:40 UTC (rev 252345)
@@ -1,3 +1,13 @@
+2019-11-11  Ross Kirsling  <[email protected]>
+
+        UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
+        https://bugs.webkit.org/show_bug.cgi?id=204032
+
+        Reviewed by Yusuke Suzuki.
+
+        * Scripts/run-jsc-stress-tests:
+        Allow environment variables to be passed to "complex" tests.
+
 2019-11-11  Dean Jackson  <[email protected]>
 
         Regression r252309: API Test TestWebKitAPI._WKActivatedElementInfo.InfoForLinkAroundImage is failing consistently

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (252344 => 252345)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2019-11-12 00:34:04 UTC (rev 252344)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2019-11-12 00:58:40 UTC (rev 252345)
@@ -1387,11 +1387,11 @@
     }
 end
 
-def runComplexTest(before, after, *options)
+def runComplexTest(before, after, additionalEnv, *options)
     prepareExtraRelativeFiles(before.map{|v| (Pathname("..") + v).to_s}, $collection)
     prepareExtraRelativeFiles(after.map{|v| (Pathname("..") + v).to_s}, $collection)
     args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options + before.map{|v| v.to_s} + [$benchmark.to_s] + after.map{|v| v.to_s}
-    addRunCommand("complex", args, silentOutputHandler, simpleErrorHandler)
+    addRunCommand("complex", args, silentOutputHandler, simpleErrorHandler, *additionalEnv)
 end
 
 def runMozillaTest(kind, mode, extraFiles, *options)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to