[Webkit-unassigned] [Bug 271524] New: Array.groupBy / Map.groupBy doesn’t work for non objects

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Mar 23 14:09:54 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=271524

            Bug ID: 271524
           Summary: Array.groupBy / Map.groupBy doesn’t work for non
                    objects
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: aosukeke at gmail.com

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
```

-- 
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/20240323/04ddd4ca/attachment.htm>


More information about the webkit-unassigned mailing list