Open Bug 1236777 Opened 8 years ago Updated 2 months ago
Array in webidl
To implement RTCTrackEvent , we should ideally use FrozenArray: // TODO: Use FrozenArray once available. // readonly attribute FrozenArray<MediaStream> streams; Workaround: [Frozen, Cached, Pure] readonly attribute sequence<MediaStream> streams;  http://w3c.github.io/webrtc-pc/#rtctrackevent
Is FrozenArray now considered stable enough? It seems fine to me, but have we had any feedback from the other browser vendors? Note that the workaround in comment 0 will in fact produce identical semantics to FrozenArray, and in fact the implementation plan for this should probably be to just desugar FrozenArray, at least for attributes, so consumers are not forced to deal with JS arrays.
The only feedback I've seen (which you have too) is in https://www.w3.org/Bugs/Public/show_bug.cgi?id=29004 where Travis still doesn't seem convinced. Really the only feasible alternative is to use non-frozen arrays, don't create new instances when we need to change their contents, define carefully how updates to arrays work, and for the platform object that vends such such arrays not to use their contents as the source of truth. The two competing concerns of "live lists are bad" and "object identity from getter should be preserved" are fundamentally at odds. At this point I don't know what can be done beyond trying it out.
We can try it out in practice using said workaround....
When this is implemented, it should be documented here: https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings
This is needed for the vibrate and actions attributes of Notifications: https://notifications.spec.whatwg.org/#api
Not really blocking anything; see comment 0. We already support this, just with an uglier syntax.
Note, I have a spec that requires `[SameObject] FrozenArray<>`. [Pure] seems incompatible with [SameObject]. See ancestorOrigins attribute here: https://w3c.github.io/ServiceWorker/#client-interface
> Note, I have a spec that requires `[SameObject] FrozenArray<>`. [Pure] seems incompatible with [SameObject]. Well, our IDL parser rejects, because [SameObject] is a stronger claim than [Pure]. Since it's a stronger claim, you can just replace "Pure" with "SameObject" in the workaround annotations. Specifically: 1) We allow a sequence<> type for an attribute if the attribute is [Cached]. See https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#Cached 2) [Cached] attributes must be [Pure] or [Constant] or [SameObject], as documented in the same place.
> because [SameObject] is a stronger claim than [Pure] Which means claiming _both_ is nonsense and you're probably doing something wrong if you claim both...
Component: DOM → DOM: Core & HTML
Flags: needinfo?(whawkins) → needinfo?(bzbarsky)
Component: DOM: Core & HTML → DOM: Bindings (WebIDL)
You need to log in before you can comment on or make changes to this bug.