Bug 223122 - [SameObject] is not applied in FrozenArrays or TypeArrays
Summary: [SameObject] is not applied in FrozenArrays or TypeArrays
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Bindings (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-12 07:53 PST by Imanol Fernandez
Modified: 2021-03-23 08:41 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Imanol Fernandez 2021-03-12 07:53:11 PST
Hi,

I'm trying to pass some WebXR [SameObject] related tests and found that [SameObject] doesn't work as expected with array related types. JS correctly receives the same object when using DOM wrappers but not when using FrozenArrays o TypedArrays (using Vec<T> and Float32Array in the C++ DOM class).

Is there any problem in the binding code generation or Vec<T>/TypesArrays should be wrapped in a special way to be cached to comply with [SameObject], such as DOMStringList instead of Vec<String>/FrozenArray<String>?

I didn't find good examples of other module specs using [SameObject] with FrozeArrays/TypedArrays, almost all of them are in WebXR spec :)
Comment 1 Chris Dumez 2021-03-18 16:40:30 PDT
        "SameObject": {
            "contextsAllowed": ["attribute"],
            "standard": {
                "url": "https://heycam.github.io/webidl/#SameObject"
            },
            "unsupported": true
        },

We just don't support [SameObject] in WebKit right now. There are way to implement this with JS visitors or [CachedAttribute] though. We do this all the time.

Where are you trying to use it exactly?
Comment 2 Chris Dumez 2021-03-18 16:42:58 PDT
(In reply to Chris Dumez from comment #1)
>         "SameObject": {
>             "contextsAllowed": ["attribute"],
>             "standard": {
>                 "url": "https://heycam.github.io/webidl/#SameObject"
>             },
>             "unsupported": true
>         },
> 
> We just don't support [SameObject] in WebKit right now. There are way to
> implement this with JS visitors or [CachedAttribute] though. We do this all
> the time.
> 
> Where are you trying to use it exactly?

MessageEvent.ports seems to be an example of FrozenArray attribute where we've implementation our custom "SameObject" support. You may be able to use that as example.
Comment 3 Radar WebKit Bug Importer 2021-03-19 08:54:19 PDT
<rdar://problem/75622221>
Comment 4 Imanol Fernandez 2021-03-23 08:41:44 PDT
MessageEvent.ports was a great example, thanks!

I implemented the related changes in bug 223635