Diff
Modified: trunk/JSTests/ChangeLog (294175 => 294176)
--- trunk/JSTests/ChangeLog 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/JSTests/ChangeLog 2022-05-13 21:55:56 UTC (rev 294176)
@@ -1,3 +1,13 @@
+2022-05-13 Ross Kirsling <[email protected]>
+
+ TemporalPlainTime::toTemporalTimeRecord shouldn't require all properties to be provided
+ https://bugs.webkit.org/show_bug.cgi?id=240394
+
+ Reviewed by Yusuke Suzuki and Darin Adler.
+
+ * stress/temporal-plaintime.js:
+ * test262/expectations.yaml: Mark 32 test cases as passing.
+
2022-05-12 Angelos Oikonomopoulos <[email protected]>
Unskip no longer failing test
Modified: trunk/JSTests/stress/temporal-plaintime.js (294175 => 294176)
--- trunk/JSTests/stress/temporal-plaintime.js 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/JSTests/stress/temporal-plaintime.js 2022-05-13 21:55:56 UTC (rev 294176)
@@ -156,23 +156,17 @@
nanosecond: 205
});
shouldBe(String(time), `19:39:09.068346205`);
-
- // This is spec bug. Currently this throws an error. But possibly this should not throw an error.
- // Tracked in https://github.com/tc39/proposal-temporal/issues/1803.
- shouldThrow(() => {
- Temporal.PlainTime.from({ hour: 19, minute: 39, second: 9 });
- }, TypeError);
}
{
// Different overflow modes
- shouldBe(String(Temporal.PlainTime.from({ hour: 15, minute: 60, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0 }, { overflow: 'constrain' })), `15:59:00`);
- shouldBe(String(Temporal.PlainTime.from({ hour: 15, minute: -1, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0 }, { overflow: 'constrain' })), `15:00:00`);
+ shouldBe(String(Temporal.PlainTime.from({ hour: 15, minute: 60 }, { overflow: 'constrain' })), `15:59:00`);
+ shouldBe(String(Temporal.PlainTime.from({ hour: 15, minute: -1 }, { overflow: 'constrain' })), `15:00:00`);
}
shouldThrow(() => {
- Temporal.PlainTime.from({ hour: 15, minute: 60, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0 }, { overflow: 'reject' });
+ Temporal.PlainTime.from({ hour: 15, minute: 60 }, { overflow: 'reject' });
}, RangeError);
shouldThrow(() => {
- Temporal.PlainTime.from({ hour: 15, minute: -1, second: 0, millisecond: 0, microsecond: 0, nanosecond: 0 }, { overflow: 'reject' });
+ Temporal.PlainTime.from({ hour: 15, minute: -1 }, { overflow: 'reject' });
}, RangeError);
shouldThrow(() => { new Temporal.PlainTime(-1); }, RangeError);
Modified: trunk/JSTests/test262/expectations.yaml (294175 => 294176)
--- trunk/JSTests/test262/expectations.yaml 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/JSTests/test262/expectations.yaml 2022-05-13 21:55:56 UTC (rev 294176)
@@ -1065,9 +1065,6 @@
test/built-ins/Temporal/Instant/prototype/toString/timezone-string-multiple-offsets.js:
default: 'RangeError: argument needs to be UTC offset string, TimeZone identifier, or temporal Instant string'
strict mode: 'RangeError: argument needs to be UTC offset string, TimeZone identifier, or temporal Instant string'
-test/built-ins/Temporal/PlainTime/compare/argument-cast.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
test/built-ins/Temporal/PlainTime/compare/argument-string-time-designator-required-for-disambiguation.js:
default: 'Test262Error: 2021-12 is ambiguous and requires T prefix (first argument) Expected a RangeError to be thrown but no exception was thrown at all'
strict mode: 'Test262Error: 2021-12 is ambiguous and requires T prefix (first argument) Expected a RangeError to be thrown but no exception was thrown at all'
@@ -1074,18 +1071,6 @@
test/built-ins/Temporal/PlainTime/compare/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
-test/built-ins/Temporal/PlainTime/compare/leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/compare/plaintime-propertybag-no-time-units.js:
- default: 'TypeError: "hour" field is missing'
- strict mode: 'TypeError: "hour" field is missing'
-test/built-ins/Temporal/PlainTime/from/argument-object-leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/argument-object.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
test/built-ins/Temporal/PlainTime/from/argument-plaindatetime.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.PlainDateTime(2000, 5, 2, 12, 34, 56, 987, 654, 321, calendar)')"
@@ -1098,30 +1083,6 @@
test/built-ins/Temporal/PlainTime/from/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
-test/built-ins/Temporal/PlainTime/from/leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/options-undefined.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/overflow-constrain.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/overflow-reject.js:
- default: 'Test262Error: Expected a RangeError but got a TypeError'
- strict mode: 'Test262Error: Expected a RangeError but got a TypeError'
-test/built-ins/Temporal/PlainTime/from/overflow-undefined.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/overflow-wrong-type.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/from/plaintime-propertybag-no-time-units.js:
- default: 'TypeError: "hour" field is missing'
- strict mode: 'TypeError: "hour" field is missing'
-test/built-ins/Temporal/PlainTime/prototype/equals/argument-cast.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
test/built-ins/Temporal/PlainTime/prototype/equals/argument-string-time-designator-required-for-disambiguation.js:
default: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
strict mode: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
@@ -1128,15 +1089,6 @@
test/built-ins/Temporal/PlainTime/prototype/equals/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
-test/built-ins/Temporal/PlainTime/prototype/equals/leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/prototype/equals/plaintime-propertybag-no-time-units.js:
- default: 'TypeError: "hour" field is missing'
- strict mode: 'TypeError: "hour" field is missing'
-test/built-ins/Temporal/PlainTime/prototype/since/argument-cast.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
test/built-ins/Temporal/PlainTime/prototype/since/argument-string-time-designator-required-for-disambiguation.js:
default: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
strict mode: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
@@ -1143,12 +1095,6 @@
test/built-ins/Temporal/PlainTime/prototype/since/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
-test/built-ins/Temporal/PlainTime/prototype/since/leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/prototype/since/plaintime-propertybag-no-time-units.js:
- default: 'TypeError: "hour" field is missing'
- strict mode: 'TypeError: "hour" field is missing'
test/built-ins/Temporal/PlainTime/prototype/since/roundingmode-ceil.js:
default: 'Test262Error: hours hours result Expected SameValue(«4», «5») to be true'
strict mode: 'Test262Error: hours hours result Expected SameValue(«4», «5») to be true'
@@ -1155,9 +1101,6 @@
test/built-ins/Temporal/PlainTime/prototype/since/roundingmode-floor.js:
default: 'Test262Error: hours hours result Expected SameValue(«5», «4») to be true'
strict mode: 'Test262Error: hours hours result Expected SameValue(«5», «4») to be true'
-test/built-ins/Temporal/PlainTime/prototype/until/argument-cast.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
test/built-ins/Temporal/PlainTime/prototype/until/argument-string-time-designator-required-for-disambiguation.js:
default: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
strict mode: 'Test262Error: 2021-12 is ambiguous and requires T prefix Expected a RangeError to be thrown but no exception was thrown at all'
@@ -1164,12 +1107,6 @@
test/built-ins/Temporal/PlainTime/prototype/until/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.ZonedDateTime(1_000_000_000_987_654_321n, timeZone)')"
-test/built-ins/Temporal/PlainTime/prototype/until/leap-second.js:
- default: 'TypeError: "microsecond" field is missing'
- strict mode: 'TypeError: "microsecond" field is missing'
-test/built-ins/Temporal/PlainTime/prototype/until/plaintime-propertybag-no-time-units.js:
- default: 'TypeError: "hour" field is missing'
- strict mode: 'TypeError: "hour" field is missing'
test/built-ins/Temporal/getOwnPropertyNames.js:
default: 'Test262Error: PlainDateTime'
strict mode: 'Test262Error: PlainDateTime'
Modified: trunk/Source/_javascript_Core/ChangeLog (294175 => 294176)
--- trunk/Source/_javascript_Core/ChangeLog 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/Source/_javascript_Core/ChangeLog 2022-05-13 21:55:56 UTC (rev 294176)
@@ -1,3 +1,18 @@
+2022-05-13 Ross Kirsling <[email protected]>
+
+ TemporalPlainTime::toTemporalTimeRecord shouldn't require all properties to be provided
+ https://bugs.webkit.org/show_bug.cgi?id=240394
+
+ Reviewed by Yusuke Suzuki and Darin Adler.
+
+ Following the spec correction of https://github.com/tc39/proposal-temporal/pull/1862, this patch
+ fixes our Temporal.PlainTime implementation to require that *one* property be provided, not *all* of them.
+
+ * runtime/TemporalDuration.cpp:
+ (JSC::TemporalDuration::fromDurationLike):
+ * runtime/TemporalPlainTime.cpp:
+ (JSC::toTemporalTimeRecord):
+
2022-05-13 Anjali Kumar <[email protected]>
Web Inspector: [Meta] Implement Timelines Film Strip
Modified: trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp (294175 => 294176)
--- trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp 2022-05-13 21:55:56 UTC (rev 294176)
@@ -94,10 +94,8 @@
JSValue value = durationLike->get(globalObject, temporalUnitPluralPropertyName(vm, unit));
RETURN_IF_EXCEPTION(scope, { });
- if (value.isUndefined()) {
- result[unit] = 0;
+ if (value.isUndefined())
continue;
- }
hasRelevantProperty = true;
result[unit] = value.toIntegerWithoutRounding(globalObject);
Modified: trunk/Source/_javascript_Core/runtime/TemporalPlainTime.cpp (294175 => 294176)
--- trunk/Source/_javascript_Core/runtime/TemporalPlainTime.cpp 2022-05-13 21:43:00 UTC (rev 294175)
+++ trunk/Source/_javascript_Core/runtime/TemporalPlainTime.cpp 2022-05-13 21:55:56 UTC (rev 294176)
@@ -301,6 +301,7 @@
auto scope = DECLARE_THROW_SCOPE(vm);
ISO8601::Duration duration { };
+ auto hasRelevantProperty = false;
for (TemporalUnit unit : temporalUnitsInTableOrder) {
if (unit < TemporalUnit::Hour)
continue;
@@ -308,13 +309,10 @@
JSValue value = temporalTimeLike->get(globalObject, name);
RETURN_IF_EXCEPTION(scope, { });
- // We are throwing an error here, but probably this is a spec bug.
- // Tracked in https://github.com/tc39/proposal-temporal/issues/1803.
- if (value.isUndefined()) {
- throwTypeError(globalObject, scope, makeString('"', StringView(name.uid()), "\" field is missing"_s));
- return { };
- }
+ if (value.isUndefined())
+ continue;
+ hasRelevantProperty = true;
double integer = value.toIntegerOrInfinity(globalObject);
RETURN_IF_EXCEPTION(scope, { });
if (!std::isfinite(integer)) {
@@ -323,6 +321,12 @@
}
duration[unit] = integer;
}
+
+ if (!hasRelevantProperty) {
+ throwTypeError(globalObject, scope, "Object must contain at least one Temporal time unit property"_s);
+ return { };
+ }
+
return duration;
}