Bug 229651 - [JSC] Implement Temporal.Calendar
Summary: [JSC] Implement Temporal.Calendar
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks: 223166
  Show dependency treegraph
 
Reported: 2021-08-28 16:13 PDT by Yusuke Suzuki
Modified: 2021-08-30 18:57 PDT (History)
16 users (show)

See Also:


Attachments
Patch (56.80 KB, patch)
2021-08-28 23:21 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (70.41 KB, patch)
2021-08-29 03:41 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (71.79 KB, patch)
2021-08-29 22:42 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (71.83 KB, patch)
2021-08-30 03:00 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (71.83 KB, patch)
2021-08-30 11:56 PDT, Yusuke Suzuki
ross.kirsling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2021-08-28 16:13:08 PDT
...
Comment 1 Yusuke Suzuki 2021-08-28 23:21:48 PDT
Created attachment 436730 [details]
Patch
Comment 2 Yusuke Suzuki 2021-08-29 03:41:15 PDT
Created attachment 436735 [details]
Patch
Comment 3 Yusuke Suzuki 2021-08-29 22:42:43 PDT
Created attachment 436757 [details]
Patch
Comment 4 Yusuke Suzuki 2021-08-30 03:00:33 PDT
Created attachment 436761 [details]
Patch
Comment 5 Yusuke Suzuki 2021-08-30 11:56:14 PDT
Created attachment 436799 [details]
Patch
Comment 6 Philip Chimento 2021-08-30 12:24:00 PDT
Comment on attachment 436799 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=436799&action=review

> Source/JavaScriptCore/runtime/IntlObject.cpp:1594
> +            if (string.is8Bit())

I believe all the BCP47 identifiers are ASCII-only, by definition?

> Source/JavaScriptCore/runtime/TemporalCalendarPrototype.cpp:98
> +        return throwVMTypeError(globalObject, scope, "Temporal.Calendar.prototype.fields called on value that's not an object initialized as a Calendar"_s);

As in the Duration patch I think the brand check exception message would be clearer to developers without "an object initialized as"
Comment 7 Yusuke Suzuki 2021-08-30 12:45:00 PDT
Comment on attachment 436799 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=436799&action=review

>> Source/JavaScriptCore/runtime/IntlObject.cpp:1594
>> +            if (string.is8Bit())
> 
> I believe all the BCP47 identifiers are ASCII-only, by definition?

This is8Bit is WTF::String implementation detail, and it is possible that ASCII-only string can get 16bit strings.
And it would be possible to make String 16bit internally in some cases (e.g. string is determined to be shared with the existing 16bit string). So putting both cases is better for safety and correctness :)
Comment 8 Ross Kirsling 2021-08-30 18:04:05 PDT
Comment on attachment 436799 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=436799&action=review

Looks good, given Philip's comments and the resolution of the Slack thread about implementation-definedness.

> Source/WTF/ChangeLog:11
> +        * wtf/text/StringImpl.cpp:
> +        (WTF::StringImpl::createStaticStringImpl):
> +        * wtf/text/StringImpl.h:
> +        (WTF::StringImpl::createStaticStringImpl):

I think this deserves a brief explanation. :)

> JSTests/stress/temporal-calendar.js:80
> +        password: 'hunter2', // Note: Don't really store passwords like that

🤣
Comment 9 Yusuke Suzuki 2021-08-30 18:23:50 PDT
Comment on attachment 436799 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=436799&action=review

>> Source/WTF/ChangeLog:11
>> +        (WTF::StringImpl::createStaticStringImpl):
> 
> I think this deserves a brief explanation. :)

Added :)

>> Source/JavaScriptCore/runtime/TemporalCalendarPrototype.cpp:98
>> +        return throwVMTypeError(globalObject, scope, "Temporal.Calendar.prototype.fields called on value that's not an object initialized as a Calendar"_s);
> 
> As in the Duration patch I think the brand check exception message would be clearer to developers without "an object initialized as"

Changed to drop `an object initialized as...` part :)
Comment 10 Yusuke Suzuki 2021-08-30 18:56:41 PDT
Committed r281788 (241125@main): <https://commits.webkit.org/241125@main>
Comment 11 Radar WebKit Bug Importer 2021-08-30 18:57:25 PDT
<rdar://problem/82559111>