Bug 271524
Summary: | Object.groupBy / Map.groupBy doesn’t work for non objects | ||
---|---|---|---|
Product: | WebKit | Reporter: | Sosuke Suzuki <aosukeke> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | mark.lam, ross.kirsling, webkit-bug-importer, ysuzuki |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Sosuke Suzuki
According to the specification, GroupBy must use RequireObjectCoercible to check that the value is not null or undefined.
However, in JSC, @isObject is used to determine this, so calling `Object.groupBy` / `Map.groupBy` with a non-object value will throw a TypeError.
poc:
```js
Object.groupBy("abc", (ch) => ch === "a" ? "one" : "two");
// Exception: TypeError: Object.groupBy requires that the first argument must be an object
```
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Sosuke Suzuki
If this is a bug, I want to work on this.
Sosuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/26383
EWS
Committed 276736@main (5209f3cb6908): <https://commits.webkit.org/276736@main>
Reviewed commits have been landed. Closing PR #26383 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/125485685>