Modified: trunk/Source/_javascript_Core/ChangeLog (281911 => 281912)
--- trunk/Source/_javascript_Core/ChangeLog 2021-09-02 08:13:12 UTC (rev 281911)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-09-02 08:52:06 UTC (rev 281912)
@@ -1,3 +1,19 @@
+2021-09-02 Ross Kirsling <ross.kirsl...@sony.com>
+
+ [JSC] Fix invalid exception checks in Temporal classes
+ https://bugs.webkit.org/show_bug.cgi?id=229793
+
+ Reviewed by Yusuke Suzuki.
+
+ * runtime/TemporalCalendarPrototype.cpp:
+ (JSC::JSC_DEFINE_HOST_FUNCTION):
+ * runtime/TemporalDuration.cpp:
+ (JSC::TemporalDuration::fromObject):
+ (JSC::TemporalDuration::toDuration):
+ (JSC::TemporalDuration::with const):
+ * runtime/TemporalDurationPrototype.cpp:
+ (JSC::JSC_DEFINE_HOST_FUNCTION):
+
2021-09-02 Yusuke Suzuki <ysuz...@apple.com>
Unreviewed, annotate executeJSCJITProbe with REFERENCED_FROM_ASM WTF_INTERNAL
Modified: trunk/Source/_javascript_Core/runtime/TemporalCalendarPrototype.cpp (281911 => 281912)
--- trunk/Source/_javascript_Core/runtime/TemporalCalendarPrototype.cpp 2021-09-02 08:13:12 UTC (rev 281911)
+++ trunk/Source/_javascript_Core/runtime/TemporalCalendarPrototype.cpp 2021-09-02 08:52:06 UTC (rev 281912)
@@ -122,7 +122,7 @@
fieldNames.append(jsNontrivialString(vm, vm.propertyNames->eraYear.impl()));
}
- return JSValue::encode(constructArray(globalObject, static_cast<ArrayAllocationProfile*>(nullptr), fieldNames));
+ RELEASE_AND_RETURN(scope, JSValue::encode(constructArray(globalObject, static_cast<ArrayAllocationProfile*>(nullptr), fieldNames)));
}
// https://tc39.es/proposal-temporal/#sec-temporal-defaultmergefields
Modified: trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp (281911 => 281912)
--- trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp 2021-09-02 08:13:12 UTC (rev 281911)
+++ trunk/Source/_javascript_Core/runtime/TemporalDuration.cpp 2021-09-02 08:52:06 UTC (rev 281912)
@@ -114,6 +114,7 @@
auto hasRelevantProperty = false;
for (size_t i = 0; i < numberOfTemporalUnits; i++) {
JSValue value = durationLike->get(globalObject, propertyName(vm, i));
+ RETURN_IF_EXCEPTION(scope, { });
if (value.isUndefined()) {
result[i] = 0;
@@ -148,9 +149,13 @@
if (itemValue.inherits<TemporalDuration>(vm))
return jsCast<TemporalDuration*>(itemValue);
- if (itemValue.isObject())
- RELEASE_AND_RETURN(scope, TemporalDuration::tryCreateIfValid(globalObject, fromObject(globalObject, asObject(itemValue))));
+ if (itemValue.isObject()) {
+ auto subdurations = fromObject(globalObject, asObject(itemValue));
+ RETURN_IF_EXCEPTION(scope, nullptr);
+ RELEASE_AND_RETURN(scope, TemporalDuration::tryCreateIfValid(globalObject, WTFMove(subdurations)));
+ }
+
String string = itemValue.toWTFString(globalObject);
RETURN_IF_EXCEPTION(scope, nullptr);
@@ -231,6 +236,7 @@
auto hasRelevantProperty = false;
for (size_t i = 0; i < numberOfTemporalUnits; i++) {
JSValue value = durationLike->get(globalObject, propertyName(vm, i));
+ RETURN_IF_EXCEPTION(scope, { });
if (value.isUndefined()) {
result[i] = m_subdurations[i];
Modified: trunk/Source/_javascript_Core/runtime/TemporalDurationPrototype.cpp (281911 => 281912)
--- trunk/Source/_javascript_Core/runtime/TemporalDurationPrototype.cpp 2021-09-02 08:13:12 UTC (rev 281911)
+++ trunk/Source/_javascript_Core/runtime/TemporalDurationPrototype.cpp 2021-09-02 08:52:06 UTC (rev 281912)
@@ -128,7 +128,10 @@
if (!durationLike.isObject())
return throwVMTypeError(globalObject, scope, "First argument to Temporal.Duration.prototype.with must be an object"_s);
- RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, duration->with(globalObject, asObject(durationLike)))));
+ auto subdurations = duration->with(globalObject, asObject(durationLike));
+ RETURN_IF_EXCEPTION(scope, { });
+
+ RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, WTFMove(subdurations))));
}
JSC_DEFINE_HOST_FUNCTION(temporalDurationPrototypeFuncNegated, (JSGlobalObject* globalObject, CallFrame* callFrame))
@@ -164,7 +167,10 @@
if (!duration)
return throwVMTypeError(globalObject, scope, "Temporal.Duration.prototype.add called on value that's not a Duration"_s);
- RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, duration->add(globalObject, callFrame->argument(0)))));
+ auto subdurations = duration->add(globalObject, callFrame->argument(0));
+ RETURN_IF_EXCEPTION(scope, { });
+
+ RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, WTFMove(subdurations))));
}
JSC_DEFINE_HOST_FUNCTION(temporalDurationPrototypeFuncSubtract, (JSGlobalObject* globalObject, CallFrame* callFrame))
@@ -176,7 +182,10 @@
if (!duration)
return throwVMTypeError(globalObject, scope, "Temporal.Duration.prototype.subtract called on value that's not a Duration"_s);
- RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, duration->subtract(globalObject, callFrame->argument(0)))));
+ auto subdurations = duration->subtract(globalObject, callFrame->argument(0));
+ RETURN_IF_EXCEPTION(scope, { });
+
+ RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, WTFMove(subdurations))));
}
JSC_DEFINE_HOST_FUNCTION(temporalDurationPrototypeFuncRound, (JSGlobalObject* globalObject, CallFrame* callFrame))
@@ -192,7 +201,10 @@
if (options.isUndefined())
return throwVMTypeError(globalObject, scope, "Temporal.Duration.prototype.round requires an options argument"_s);
- RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, duration->round(globalObject, options))));
+ auto subdurations = duration->round(globalObject, options);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ RELEASE_AND_RETURN(scope, JSValue::encode(TemporalDuration::tryCreateIfValid(globalObject, WTFMove(subdurations))));
}
JSC_DEFINE_HOST_FUNCTION(temporalDurationPrototypeFuncTotal, (JSGlobalObject* globalObject, CallFrame* callFrame))