https://bugs.webkit.org/show_bug.cgi?id=189465
Patch by Rob Buis <rbuis@igalia.com> on 2018-09-10
Reviewed by Frédéric Wang.
LayoutTests/imported/w3c:
* web-platform-tests/xhr/overridemimetype-invalid-mime-type-expected.txt:
Source/WebCore:
The xhr spec changed [1, 2] so that overrideMimeType should not update the
response's "Content-Type" header anymore.
Behavior matches Firefox and Chrome.
[1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-overridemimetype
[2] https://github.com/whatwg/xhr/issues/157
Tests: http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html
web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didReceiveResponse):
LayoutTests:
Change existing test to reflect new behavior.
* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header-expected.txt:
* http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235844
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-09-10 Rob Buis <rbuis@igalia.com>
+
+ XMLHttpRequest: overrideMimeType should not update the response's "Content-Type" header
+ https://bugs.webkit.org/show_bug.cgi?id=189465
+
+ Reviewed by Frédéric Wang.
+
+ Change existing test to reflect new behavior.
+
+ * http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header-expected.txt:
+ * http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html:
+
2018-09-10 Antoine Quint <graouts@apple.com>
[Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
-This tests that XMLHttpRequest overrideMimeType() properly updates the Content-Type header for the response.
+This tests that XMLHttpRequest overrideMimeType() does not update the Content-Type header for the response.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS xhr.getResponseHeader("Content-Type") is "text/xml;charset=GBK"
+PASS xhr.getResponseHeader("Content-Type") is "application/xml"
PASS successfullyParsed is true
TEST COMPLETE
</head>
<body>
<script>
- description('This tests that XMLHttpRequest overrideMimeType() properly updates the Content-Type header for the response.');
+ description('This tests that XMLHttpRequest overrideMimeType() does not update the Content-Type header for the response.');
window.jsTestIsAsync = true;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == xhr.LOADING) {
- shouldBe('xhr.getResponseHeader("Content-Type")', '"text/xml;charset=GBK"');
+ shouldBe('xhr.getResponseHeader("Content-Type")', '"application/xml"');
finishJSTest();
}
}
+2018-09-10 Rob Buis <rbuis@igalia.com>
+
+ XMLHttpRequest: overrideMimeType should not update the response's "Content-Type" header
+ https://bugs.webkit.org/show_bug.cgi?id=189465
+
+ Reviewed by Frédéric Wang.
+
+ * web-platform-tests/xhr/overridemimetype-invalid-mime-type-expected.txt:
+
2018-09-07 Youenn Fablet <youenn@apple.com>
Add support for unified plan transceivers
-FAIL Bogus MIME type does not override encoding assert_equals: expected "text/html;charset=windows-1252" but got "bogus"
+PASS Bogus MIME type does not override encoding
FAIL Bogus MIME type does not override encoding, 2 assert_equals: expected "ÿ" but got "\x1a"
-FAIL Bogus MIME type does override MIME type assert_equals: expected "text/xml" but got "bogus"
+PASS Bogus MIME type does override MIME type
+2018-09-10 Rob Buis <rbuis@igalia.com>
+
+ XMLHttpRequest: overrideMimeType should not update the response's "Content-Type" header
+ https://bugs.webkit.org/show_bug.cgi?id=189465
+
+ Reviewed by Frédéric Wang.
+
+ The xhr spec changed [1, 2] so that overrideMimeType should not update the
+ response's "Content-Type" header anymore.
+
+ Behavior matches Firefox and Chrome.
+
+ [1] https://xhr.spec.whatwg.org/#dom-xmlhttprequest-overridemimetype
+ [2] https://github.com/whatwg/xhr/issues/157
+
+ Tests: http/tests/xmlhttprequest/xmlhttprequest-overridemimetype-content-type-header.html
+ web-platform-tests/xhr/overridemimetype-invalid-mime-type.htm
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::didReceiveResponse):
+
2018-09-10 Antoine Quint <graouts@apple.com>
[Web Animations] Interrupting an accelerated CSS transition on a composited element in flight fails
void XMLHttpRequest::didReceiveResponse(unsigned long, const ResourceResponse& response)
{
m_response = response;
- if (!m_mimeTypeOverride.isEmpty())
- m_response.setHTTPHeaderField(HTTPHeaderName::ContentType, m_mimeTypeOverride);
}
static inline bool shouldDecodeResponse(XMLHttpRequest::ResponseType type)
if (readyState() < HEADERS_RECEIVED)
changeState(HEADERS_RECEIVED);
- // FIXME: Should we update "Content-Type" header field with m_mimeTypeOverride value in case it has changed since didReceiveResponse?
if (!m_mimeTypeOverride.isEmpty())
m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride);
if (m_responseEncoding.isEmpty())