[Webkit-unassigned] [Bug 253814] Concat with a CSSStyleSheet and shadowRoot.adoptedStyleSheets returns array in array

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 13 08:06:44 PDT 2023


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

--- Comment #6 from Chris Dumez <cdumez at apple.com> ---
(In reply to Chris Dumez from comment #5)
> Ecmascript for concat [1] says to rely on IsConcatSpreadable() [2].
> IsConcatSpreadable() checks the @@isConcatSpreadable symbol and then
> fallback to calling IsArray() [3].
> 
> ObservableArray is defined here [4].
> 
> [1]
> https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.
> prototype.concat
> [2]
> https://tc39.es/ecma262/multipage/indexed-collections.html#sec-
> isconcatspreadable
> [3] https://tc39.es/ecma262/multipage/abstract-operations.html#sec-isarray
> [4] https://webidl.spec.whatwg.org/#es-observable-array

>From https://webidl.spec.whatwg.org/#observable-array-exotic-object:
```
An observable array exotic object is a specific type of ECMAScript Proxy exotic object which is created using the proxy traps defined in this section. They are defined in this manner because the ECMAScript specification includes special treatment for Proxy exotic objects that have Array instances as their proxy target, and we want to ensure that observable array types are exposed to ECMAScript code with this special treatment intact.
```

So I believe concat should indeed spread the observable array here. However, our implementation currently relies on isJSArray(), not isArray() (which would be what the spec says).

-- 
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/20230313/277cbcc5/attachment.htm>


More information about the webkit-unassigned mailing list