-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add more XMLHttpRequest overrideMimeType() tests #8449
Conversation
Build PASSEDStarted: 2017-12-04 14:39:08 View more information about this build on: |
This is ready for review now. This is what is remaining:
|
Reset override MIME type when open() is invoked. Actually make overriding the charset parameter work (setting override MIME type to the "MIME type portion" (now essence) as done previously would always erase it. Tests: web-platform-tests/wpt#8449.
5768bb1
to
bc47269
Compare
Reset override MIME type when open() is invoked. Actually make overriding the charset parameter work (setting override MIME type to the "MIME type portion" (now essence) as done previously would always erase it. Tests: web-platform-tests/wpt#8449.
bc47269
to
e7bc32b
Compare
This could use review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with comments
@@ -6,60 +6,67 @@ | |||
<div id="log"></div> | |||
<script> | |||
async_test(t => { | |||
const client = new XMLHttpRequest() | |||
const client = new XMLHttpRequest(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is extraordinarily hard to review because almost every line has changed, but I guess only because of semicolons? Please split up the commits at least next time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I figured it wouldn't be much of an issue given how GitHub highlights stuff.
client.open("GET", "resources/status.py?content=thisshouldnotmakeadifferencebutdoes"); | ||
client.responseType = "blob"; | ||
client.send(); | ||
}, "Use text/xml as fallback MIME type, 2"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why the above two tests are in a file related to overrideMimeType()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good reason.
xhr/overridemimetype-blob.html
Outdated
client.open("GET", "resources/status.py"); | ||
client.responseType = "blob"; | ||
client.overrideMimeType(type); | ||
client.send(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: whitespace is off here
xhr/overridemimetype-blob.html
Outdated
["text/html;", "text/html"], | ||
["x/x;?=x;charset=y", "x/x;charset=y"], | ||
["text/html;x=ÿ", "text/html;x=\"ÿ\""] | ||
].forEach(([inputType, outputType], index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like you could use the whole JSON file for the above two tests. (If the JSON files says a parse failure, application/octet-stream; otherwise use the output.) As I've argued previously, this helps ensure that the same parser is being used in all parts of the codebase.
Reset override MIME type when open() is invoked. Actually make overriding the charset parameter work (setting override MIME type to the "MIME type portion" (now essence) as done previously would always erase it. Tests: web-platform-tests/wpt#8449.
I've made the change of using the smaller JSON resource here (since it's networking it doesn't seem good to use all), but I need to verify whether some tests should be added to that JSON resource resource that I've removed here or whether coverage remained equivalent. I should probably also have another look at code point usage just in case. |
Build PASSEDStarted: 2018-04-16 11:32:46 View more information about this build on: |
This makes a number of changes: * Integrates with the new MIME Sniffing infrastructure. * Reset override MIME type when open() is invoked. * Actually make overriding the charset parameter work (setting override MIME type to the "MIME type portion" (now essence) as done previously would always erase it). * Use "get an encoding" (previously undefined) to convert from a label to an encoding. Tests: web-platform-tests/wpt#8449. Fixes #157.
Can I suggest a test here? I don't see any tests to confirm that the browser follows step 12 of the updated spec for
ETA: if this merits a new issue, I'd be happy to open one. ETA Again: just found #12404, please disregard. |
@thworted, yeah, it turned out that resetting the MIME type wasn't web compatible (or at least that's how I read the outcome of the investigation in #12289). |
The worst part is that to be truly compatible, everybody will have to treat |
Web developers should probably fix their servers to not send broken MIME types and migrate to |
The first thing that comes to mind is XHR against a peer resource in a Maybe that's not compelling enough? Still, |
This makes a number of changes: * Integrates with the new MIME Sniffing infrastructure. * Reset override MIME type when open() is invoked. * Actually make overriding the charset parameter work (setting override MIME type to the "MIME type portion" (now essence) as done previously would always erase it). * Use "get an encoding" (previously undefined) to convert from a label to an encoding. Tests: web-platform-tests/wpt#8449. Fixes #157.
For whatwg/xhr#157 and whatwg/mimesniff#42.