[Webkit-unassigned] [Bug 230331] Various tweaks in preparation for Temporal.Instant
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Sep 15 18:31:56 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=230331
Yusuke Suzuki <ysuzuki at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ysuzuki at apple.com
--- Comment #2 from Yusuke Suzuki <ysuzuki at apple.com> ---
Comment on attachment 438310
--> https://bugs.webkit.org/attachment.cgi?id=438310
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=438310&action=review
> Source/JavaScriptCore/runtime/TemporalDuration.cpp:146
> - throwRangeError(globalObject, scope, "Could not parse Duration string"_s);
> + throwRangeError(globalObject, scope, makeString("'"_s, string, "' is not a valid Duration string"_s));
Need to handle the case string is INT32_MAX size already.
We need to truncate the string if it is too long.
> Source/JavaScriptCore/runtime/TemporalObject.cpp:65
> -static JSValue createNowObject(VM& vm, JSObject* object)
> +static JSValue createDurationConstructor(VM& vm, JSObject* object)
> {
> TemporalObject* temporalObject = jsCast<TemporalObject*>(object);
> JSGlobalObject* globalObject = temporalObject->globalObject(vm);
> - return TemporalNow::create(vm, TemporalNow::createStructure(vm, globalObject));
> + return TemporalDurationConstructor::create(vm, TemporalDurationConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<TemporalDurationPrototype*>(globalObject->durationStructure()->storedPrototypeObject()));
> }
>
> -static JSValue createDurationConstructor(VM& vm, JSObject* object)
> +static JSValue createNowObject(VM& vm, JSObject* object)
> {
> TemporalObject* temporalObject = jsCast<TemporalObject*>(object);
> JSGlobalObject* globalObject = temporalObject->globalObject(vm);
> - return TemporalDurationConstructor::create(vm, TemporalDurationConstructor::createStructure(vm, globalObject, globalObject->functionPrototype()), jsCast<TemporalDurationPrototype*>(globalObject->durationStructure()->storedPrototypeObject()));
> + return TemporalNow::create(vm, TemporalNow::createStructure(vm, globalObject));
> }
>
I don't think these changes are necessary.
> Source/JavaScriptCore/runtime/TemporalObject.cpp:171
> +String temporalUnitToString(TemporalUnit unit)
> +{
> + switch (unit) {
> + case TemporalUnit::Year: return "year"_s;
> + case TemporalUnit::Month: return "month"_s;
> + case TemporalUnit::Week: return "week"_s;
> + case TemporalUnit::Day: return "day"_s;
> + case TemporalUnit::Hour: return "hour"_s;
> + case TemporalUnit::Minute: return "minute"_s;
> + case TemporalUnit::Second: return "second"_s;
> + case TemporalUnit::Millisecond: return "millisecond"_s;
> + case TemporalUnit::Microsecond: return "microsecond"_s;
> + case TemporalUnit::Nanosecond: return "nanosecond"_s;
> + }
> + ASSERT_NOT_REACHED();
> +}
Use TemporalDuration.cpp's propertyName.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210916/5d918da0/attachment.htm>
More information about the webkit-unassigned
mailing list