Skip to content
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

Update type of MediaMetadata's artwork #343

Merged
merged 5 commits into from
Oct 4, 2024
Merged

Conversation

youennf
Copy link
Contributor

@youennf youennf commented Sep 26, 2024

Fixes #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.

Implement the conversion on setter and on getter.
Based on #243 work from @ChunMinChang


Preview | Diff

ChunMinChang and others added 2 commits September 26, 2024 10:32
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
Co-authored-by: Marcos Cáceres <[email protected]>
@youennf
Copy link
Contributor Author

youennf commented Sep 26, 2024

Also fixes #241.

@youennf
Copy link
Contributor Author

youennf commented Sep 27, 2024

May also fix #183

@youennf
Copy link
Contributor Author

youennf commented Sep 27, 2024

@foolip, @annevk, I am interested in your feedback on the PR, since it is touching WebIDL, FrozenArray and friends.

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.
Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is correct. The one thing I'd change is to link "convert" throughout.

(And maybe I should finally fix whatwg/notifications#125 to say a similar thing.)

cc @domenic

@youennf
Copy link
Contributor Author

youennf commented Sep 30, 2024

@annevk, I updated the convert links.
@steimelchrome, does this look good to you? Maybe @padenot as well on Firefox side?

@youennf
Copy link
Contributor Author

youennf commented Oct 2, 2024

Testing now actually, Firefox is actually aligned with the spec (metadata.artwork === metadata.artwork) but Safari and Chrome are not.
I'll file a bug on WebKit and Chrome repository.

@youennf
Copy link
Contributor Author

youennf commented Oct 2, 2024

I filed https://issues.chromium.org/issues/370844795 and https://bugs.webkit.org/show_bug.cgi?id=280764.

@youennf youennf merged commit 3fbd743 into w3c:main Oct 4, 2024
2 checks passed
github-actions bot added a commit that referenced this pull request Oct 4, 2024
SHA: 3fbd743
Reason: push, by youennf

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The freezing in the artwork getter is broken
5 participants