-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The freezing in the artwork getter is broken #237
Comments
How does this spec imagine people change metadata? It would help if the examples showed this. Here's what I get in Chrome: navigator.mediaSession.metadata = new MediaMetadata({artist:"Ƭ̵̬̊", artwork:[{src:"A.png"}]})
navigator.mediaSession.metadata.artist = "Prince"
navigator.mediaSession.metadata.artwork[0].src = "B.png"
navigator.mediaSession.metadata.artist // Prince
navigator.mediaSession.metadata.artwork[0].src // "http://example.com/A.png"
The other thing that's odd is there's no way to add or remove artwork. How do I do that? If things are meant to be changed solely through the constructor, I'd make |
Or make navigator.mediaSession.metadata.artwork[0].src = "B.png" |
So there are two different issues here:
|
Since the entries in the MediaMetadata's `artwork` are frozen in the current spec, the type of the attribute `artwork` must be `FrozenArray<object>` rather than `FrozenArray<MediaImage>`, otherwise the entries of artwork can not be frozen[1]. This change will address issue w3c#237 The `artwork` in `MediaMetadataInit` and `MediaMetadata` will be clearly different after changing the `artwork` in `MediaMetadata` to `FrozenArray<object>`, hence the _getter_, _setter_ of `artwork` and the _convert artwork algorithm_ should be updated to match the change. This change will address issue w3c#176 [1] https://tc39.es/ecma262/#sec-object.freeze
Since the entries in the MediaMetadata's `artwork` are frozen in the current spec [1], the type of the attribute `artwork` must be `FrozenArray<object>` rather than `FrozenArray<MediaImage>`, otherwise the entries of artwork can not be frozen [2]. This change will address issue w3c#237 The `artwork` in `MediaMetadataInit` and `MediaMetadata` will be clearly different after changing the `artwork` in `MediaMetadata` to `FrozenArray<object>`, hence the _getter_, _setter_ of `artwork` and the _convert artwork algorithm_ should be updated to match the change. This change will address issue w3c#176 [1] https://github.com/web-platform-tests/wpt/blob/801a2b3b5e1cd0192f31890ddf9ee7b4d0ad9e89/mediasession/mediametadata.html#L148 [2] https://tc39.es/ecma262/#sec-object.freeze
Since the entries in the MediaMetadata's `artwork` are frozen in the current spec [1], the type of the attribute `artwork` must be `FrozenArray<object>` rather than `FrozenArray<MediaImage>`. Otherwise the entries of artwork can not be frozen [2]. This change will address issue w3c#237 The `artwork` in `MediaMetadataInit` and `MediaMetadata` will be clearly different after changing the `artwork` in `MediaMetadata` to `FrozenArray<object>`, hence the _getter_, _setter_ of `artwork` and the _convert artwork algorithm_ should be updated to match the change. This change will address issue w3c#176 [1] https://github.com/web-platform-tests/wpt/blob/801a2b3b5e1cd0192f31890ddf9ee7b4d0ad9e89/mediasession/mediametadata.html#L148 [2] https://tc39.es/ecma262/#sec-object.freeze
Since the entries in the MediaMetadata's `artwork` are frozen in the current spec [1], the type of the attribute `artwork` must be `FrozenArray<object>` rather than `FrozenArray<MediaImage>`. Otherwise the entries of artwork can not be frozen [2]. This change will address issue w3c#237 The `artwork` in `MediaMetadataInit` and `MediaMetadata` will be clearly different after changing the `artwork` in `MediaMetadata` to `FrozenArray<object>`, hence the _getter_, _setter_ of `artwork` and the _convert artwork algorithm_ should be updated to match the change. This change will address issue w3c#176 [1] https://github.com/web-platform-tests/wpt/blob/801a2b3b5e1cd0192f31890ddf9ee7b4d0ad9e89/mediasession/mediametadata.html#L148 [2] https://tc39.es/ecma262/#sec-object.freeze
Fixes w3c#237 Introduce a slot where we store the FrozenArray so that the getter always returns the same object. Make sure the slot is reset when the setter is called.
Fixes w3c#237 Introduce a slot where we store the FrozenArray so that the getter always returns the same object. Make sure the slot is reset when the setter is called.
Fixes w3c#237 Introduce a slot where we store the FrozenArray so that the getter always returns the same object. Make sure the slot is reset when the setter is called.
Fixes w3c#237 Introduce a slot where we store the FrozenArray so that the getter always returns the same object. Make sure the slot is reset when the setter is called.
PR available at #343 |
In https://w3c.github.io/mediasession/#dom-mediametadata-artwork there is this step:
But image is an IDL dictionary here, not a JS value, so you can't call
Object.freeze
on it.Maybe this means to say that you convert the dictionary to a JS object, then freeze it? That would be a viable option if this is the defined behavior, but then the
artwork
attribute should returnFrozenArray<object>
, because when you're creating theFrozenArray
it's done from a list of objects, not a list ofMediaImage
dictionaries.The text was updated successfully, but these errors were encountered: