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

Use a more common serialization for MIME types #86

Closed
wants to merge 1 commit into from

Conversation

annevk
Copy link
Member

@annevk annevk commented Oct 16, 2018

This is a defense-in-depth for the issues that arised at #84. In theory they are all solved by whatwg/xhr#224, but given how quickly several sites turned up that relied on a space, it seems prudent to standardize on that serialization to avoid similar issues elsewhere.


Preview | Diff

This is a defense-in-depth for the issues that arised at #84. In theory they are all solved by whatwg/xhr#224, but given how quickly several sites turned up that relied on a space, it seems prudent to standardize on that serialization to avoid similar issues elsewhere.
@annevk annevk requested review from domenic and hsivonen October 16, 2018 13:32
@annevk
Copy link
Member Author

annevk commented Oct 16, 2018

cc @wisniewskit

annevk added a commit to web-platform-tests/wpt that referenced this pull request Oct 16, 2018
…ialization

Tests for whatwg/xhr#224 and whatwg/mimesniff#86. They are combined in a single commit as otherwise there would be two rounds of changes to the XMLHttpRequest tests, while they are really supposed to be coupled.
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

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

I'm curious to what extent this is more or less compatible with what browsers do today in non-overrideMimeType contexts. But, editorially LGTM.

@annevk
Copy link
Member Author

annevk commented Oct 16, 2018

The issues are not due to overrideMimeType(), but manipulating Content-Type. This change would affect the former though. For both cases browsers historically only scanned the input string and only changed it in place. The only other context we have to compare with is Blob I think and like other contexts browsers don't really parse/serialize there (just pass the string through) at the moment.

@domenic
Copy link
Member

domenic commented Oct 16, 2018

Yeah, if the only other case where browsers serialize (or should serialize) is blobs, then I guess this will probably work out ok.

domenic added a commit to jsdom/whatwg-mimetype that referenced this pull request Oct 17, 2018
annevk added a commit to web-platform-tests/wpt that referenced this pull request Oct 18, 2018
…ialization

Tests for whatwg/xhr#224 and whatwg/mimesniff#86. They are combined in a single commit as otherwise there would be two rounds of changes to the XMLHttpRequest tests, while they are really supposed to be coupled.
@annevk
Copy link
Member Author

annevk commented Oct 19, 2018

As noted in web-platform-tests/wpt#13544 (comment) I'm no longer convinced we should do this. The XMLHttpRequest change addresses all known issues, so let's keep the MIME type serializer stable for now.

@domenic
Copy link
Member

domenic commented Oct 26, 2018

Shall we close this then?

I'll note that the original implementation in jsdom actually included the inter-segment whitespace in the parsed data structure, for this sort of reason :(

@annevk
Copy link
Member Author

annevk commented Oct 30, 2018

Yeah, let's close this. To your aside, if sites actually depend on that they might depend on much more (such as text/html;garbage;charset=windows-1252 being preserved), so fingers crossed they don't and it's just XMLHttpRequest that needs more special casing.

@annevk annevk closed this Oct 30, 2018
@annevk annevk deleted the annevk/mime-type-serialization branch October 30, 2018 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants