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

fetch assumes a url's object is always a Blob #457

Closed
isonmad opened this issue Jan 16, 2017 · 6 comments
Closed

fetch assumes a url's object is always a Blob #457

isonmad opened this issue Jan 16, 2017 · 6 comments

Comments

@isonmad
Copy link
Contributor

isonmad commented Jan 16, 2017

When it could be a MediaSource or a MediaStream. whatwg/url@1099bb2 So the following doesn't make sense:

Append Content-Length/blob’s size attribute value to response’s header list.
Append Content-Type/blob’s type attribute value to response’s header list.

What happens if someone tries to fetch one of the other kinds of blob: URIs?

@annevk
Copy link
Member

annevk commented Jan 16, 2017

That is a good question. The problem is that implementations do different things here, but we should indeed work on figuring this out. See also w3c/mediacapture-main#404.

Adding @foolip and @jan-ivar.

@jan-ivar
Copy link

Another reason media streams and sources should not be urls.

@annevk
Copy link
Member

annevk commented Jan 18, 2017

That would be ideal. @jan-ivar do you think we can eventually remove support? I suppose I could start by just adding a warning to Fetch about non-blob: usage (I don't think we can get ever rid of those).

@foolip
Copy link
Member

foolip commented Jan 24, 2017

For this issue specifically, I suppose one could simply treat it as an error and fail the request? What do implementations actually do?

If no implementers wants to move on w3c/mediacapture-main#404 then I suppose one alternative would be to go back to a separate protocol for the non-Blob blob: URLs, but that's a bit of churn too.

@annevk annevk added the needs tests Moving the issue forward requires someone to write tests label Apr 11, 2018
@annevk
Copy link
Member

annevk commented Apr 17, 2018

So

stream = new MediaStream();
streamURL = URL.createObjectURL(stream);
fetch(streamURL);

does indeed result in a TypeError in Chrome and Firefox (same for MediaSource), but what can streamURL be used for then? If you cannot fetch it, why support it to begin with?

@annevk
Copy link
Member

annevk commented Apr 17, 2018

Aaah, okay, so the way this works is that https://html.spec.whatwg.org/#concept-media-load-resource handles blob: URLs itself and doesn't pass anything toward Fetch. That indeed makes things easier here.

annevk added a commit that referenced this issue Apr 17, 2018
The reason this works is that https://html.spec.whatwg.org/#concept-media-load-resource (HTML's media element fetching algorithm) special cases MediaSource and MediaStream and handles them way before Fetch is hit.

Tests: ...

Fixes #457.
@annevk annevk removed the needs tests Moving the issue forward requires someone to write tests label Apr 17, 2018
annevk added a commit that referenced this issue Apr 18, 2018
The reason this works is that https://html.spec.whatwg.org/#concept-media-load-resource (HTML's media element fetching algorithm) special cases MediaSource and handles it way before Fetch is hit.

Tests: web-platform-tests/wpt#10509 and web-platform-tests/wpt#10515.

Follow-up: whatwg/url#380.

Fixes #457.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants