Bug 223626

Summary: [JSC] Use ErrorInstance for AggregateError
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, ews-watchlist, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Yusuke Suzuki 2021-03-22 23:28:30 PDT
[JSC] Use ErrorInstance for AggregateError
Comment 1 Yusuke Suzuki 2021-03-22 23:31:21 PDT
Created attachment 423990 [details]
Patch
Comment 2 Darin Adler 2021-03-23 10:03:03 PDT
Comment on attachment 423990 [details]
Patch

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

> Source/JavaScriptCore/runtime/AggregateError.cpp:54
> +    auto* array = constructArray(globalObject, static_cast<ArrayAllocationProfile*>(nullptr), errorsList);

Surprised that we need the ArrayAllocationProfile cast. I don’t see so much overloading for constructArray that I would have expected ambiguity.

> Source/JavaScriptCore/runtime/AggregateError.cpp:58
> +    error->putDirect(vm, vm.propertyNames->errors, array, static_cast<unsigned>(PropertyAttribute::DontEnum));

We should consider moving from unsigned to OptionSet for property attributes. Not sure how people who regularly work on JavaScriptCore feel about that, but I would love it.
Comment 3 Yusuke Suzuki 2021-03-23 12:49:31 PDT
Comment on attachment 423990 [details]
Patch

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

>> Source/JavaScriptCore/runtime/AggregateError.cpp:54
>> +    auto* array = constructArray(globalObject, static_cast<ArrayAllocationProfile*>(nullptr), errorsList);
> 
> Surprised that we need the ArrayAllocationProfile cast. I don’t see so much overloading for constructArray that I would have expected ambiguity.

This static_cast is necessary since there is `JS_EXPORT_PRIVATE JSArray* constructArray(JSGlobalObject*, Structure*, const ArgList& values);`.

>> Source/JavaScriptCore/runtime/AggregateError.cpp:58
>> +    error->putDirect(vm, vm.propertyNames->errors, array, static_cast<unsigned>(PropertyAttribute::DontEnum));
> 
> We should consider moving from unsigned to OptionSet for property attributes. Not sure how people who regularly work on JavaScriptCore feel about that, but I would love it.

We should consider this option at some point.
Comment 4 EWS 2021-03-23 12:57:58 PDT
Committed r274893: <https://commits.webkit.org/r274893>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 423990 [details].
Comment 5 Radar WebKit Bug Importer 2021-03-23 12:58:41 PDT
<rdar://problem/75750983>