Skip to content

Make a more explicit call to fetch, including options such as destination and mode#359

Merged
youennf merged 1 commit into
w3c:mainfrom
youennf:clarify-fetch-algorithm
Apr 30, 2025
Merged

Make a more explicit call to fetch, including options such as destination and mode#359
youennf merged 1 commit into
w3c:mainfrom
youennf:clarify-fetch-algorithm

Conversation

@youennf
Copy link
Copy Markdown
Contributor

@youennf youennf commented Apr 15, 2025

Fixes #346


Preview | Diff

Comment thread index.bs Outdated
<dfn>preferred artwork image</dfn> from <var>metadata</var>'s
{{MediaMetadata/artwork}} of the <a>active media session</a>.
</li>
<li>Let <var>request</var> be a new [=request=] whose URL is the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should probably use [=request/URL=], [=request/mode=] and such here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread index.bs Outdated
{{MediaMetadata/artwork}} of the <a>active media session</a>.
</li>
<li>Let <var>request</var> be a new [=request=] whose URL is the
<a>preferred artwork image</a>'s {{MediaImage/src}}, destination
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This state seems to come out of nowhere? Also, it looks like MediaImage/src is a string that needs to be parsed into a URL first? What happens if that fails?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

src is being parsed when setting the metadata. It is true it is a bit confusing since {{MediaImage/src}} here contains a properly parsed URL and not a USVString. Maybe there is a better way of doing things.

@youennf youennf force-pushed the clarify-fetch-algorithm branch from 4def6b7 to 9dc2811 Compare April 15, 2025 14:32
@youennf youennf requested a review from annevk April 16, 2025 08:23
Copy link
Copy Markdown
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 guess reworking that has to be a follow-up, but you can't just assign the result of the URL parser to a dictionary member that contains a string. It would be better if you had some specification-internal struct (https://infra.spec.whatwg.org/#structs) to hold the data after processing.

Another thing that seems broken is the amount of ambient state. The fetch image algorithm has no parameters, but somehow has access to all kinds of state.

But the change in question here seems reasonable amid the questionable things.

@youennf
Copy link
Copy Markdown
Contributor Author

youennf commented Apr 17, 2025

@steimelchrome, any thoughts?
I think this matches Chrome behavior as well, validation would be good.

It would be better if you had some specification-internal struct

Yep agreed.
I'll do a follow up based on #360.

The fetch image algorithm has no parameters, but somehow has access to all kinds of state.

Do you mean that this algorithm should take a MediaSession object as input for instance?

@annevk
Copy link
Copy Markdown
Member

annevk commented Apr 17, 2025

Yeah probably, it needs something to start its operations from and communicate back to.

Copy link
Copy Markdown
Contributor

@steimelchrome steimelchrome left a comment

Choose a reason for hiding this comment

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

Sorry for the delay was OOO for a bit. Yep, this looks reasonable to me. Thanks!

@youennf youennf merged commit d9f088f into w3c:main Apr 30, 2025
2 checks passed
github-actions Bot added a commit that referenced this pull request Apr 30, 2025
…tion and mode. (#359)

SHA: d9f088f
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 use of the fetch algorithm for image resources is optional and underspecified

3 participants