Bug 223122

Summary: [SameObject] is not applied in FrozenArrays or TypeArrays
Product: WebKit Reporter: Imanol Fernandez <ifernandez>
Component: BindingsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ashvayka, cdumez, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Imanol Fernandez
Reported 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 :)
Attachments
Chris Dumez
Comment 1 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?
Chris Dumez
Comment 2 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.
Radar WebKit Bug Importer
Comment 3 2021-03-19 08:54:19 PDT
Imanol Fernandez
Comment 4 2021-03-23 08:41:44 PDT
MessageEvent.ports was a great example, thanks! I implemented the related changes in bug 223635
Note You need to log in before you can comment on or make changes to this bug.