Title: [267959] trunk
- Revision
- 267959
- Author
- commit-qu...@webkit.org
- Date
- 2020-10-05 03:30:33 -0700 (Mon, 05 Oct 2020)
Log Message
Make xhr.response more conforming to the specification
https://bugs.webkit.org/show_bug.cgi?id=217296
Patch by Rob Buis <rb...@igalia.com> on 2020-10-05
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Update improved test result.
* web-platform-tests/xhr/overridemimetype-blob-expected.txt:
Source/WebCore:
Make xhr.response more conforming to the specification when dealing
with Blob type responses, the type for the Blob should be computed
by the "get a final MIME type" algorithm [1, 2].
Behavior matches Firefox.
Test: imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
[1] https://xhr.spec.whatwg.org/#ref-for-final-mime-type③
[2] https://xhr.spec.whatwg.org/#final-mime-type
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::createResponseBlob):
(WebCore::XMLHttpRequest::responseMIMEType const):
* xml/XMLHttpRequest.h:
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (267958 => 267959)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-10-05 09:46:39 UTC (rev 267958)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-10-05 10:30:33 UTC (rev 267959)
@@ -1,3 +1,14 @@
+2020-10-05 Rob Buis <rb...@igalia.com>
+
+ Make xhr.response more conforming to the specification
+ https://bugs.webkit.org/show_bug.cgi?id=217296
+
+ Reviewed by Darin Adler.
+
+ Update improved test result.
+
+ * web-platform-tests/xhr/overridemimetype-blob-expected.txt:
+
2020-10-04 Antoine Quint <grao...@webkit.org>
Add non-animated support for the CSS scale property
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt (267958 => 267959)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt 2020-10-05 09:46:39 UTC (rev 267958)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt 2020-10-05 10:30:33 UTC (rev 267959)
@@ -2,62 +2,62 @@
PASS Use text/xml as fallback MIME type
PASS Use text/xml as fallback MIME type, 2
PASS Loading data…
-FAIL 1) MIME types need to be parsed and serialized: text/html;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 2) MIME types need to be parsed and serialized: TEXT/HTML;CHARSET=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html"
-FAIL 3) MIME types need to be parsed and serialized: text/html;charset=gbk( assert_equals: expected "text/html;charset=\"gbk(\"" but got "text/html"
-FAIL 4) MIME types need to be parsed and serialized: text/html;x=(;charset=gbk assert_equals: expected "text/html;x=\"(\";charset=gbk" but got "text/html"
-FAIL 5) MIME types need to be parsed and serialized: text/html;charset=gbk;charset=windows-1255 assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 6) MIME types need to be parsed and serialized: text/html;charset=();charset=GBK assert_equals: expected "text/html;charset=\"()\"" but got "text/html"
+PASS 1) MIME types need to be parsed and serialized: text/html;charset=gbk
+FAIL 2) MIME types need to be parsed and serialized: TEXT/HTML;CHARSET=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html;charset=gbk"
+PASS 3) MIME types need to be parsed and serialized: text/html;charset=gbk(
+PASS 4) MIME types need to be parsed and serialized: text/html;x=(;charset=gbk
+PASS 5) MIME types need to be parsed and serialized: text/html;charset=gbk;charset=windows-1255
+PASS 6) MIME types need to be parsed and serialized: text/html;charset=();charset=GBK
PASS 7) MIME types need to be parsed and serialized: text/html;charset =gbk
-FAIL 8) MIME types need to be parsed and serialized: text/html ;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 9) MIME types need to be parsed and serialized: text/html; charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 10) MIME types need to be parsed and serialized: text/html;charset= gbk assert_equals: expected "text/html;charset=\" gbk\"" but got "text/html"
-FAIL 11) MIME types need to be parsed and serialized: text/html;charset= "gbk" assert_equals: expected "text/html;charset=\" \\\"gbk\\\"\"" but got "text/html"
+PASS 8) MIME types need to be parsed and serialized: text/html ;charset=gbk
+PASS 9) MIME types need to be parsed and serialized: text/html; charset=gbk
+PASS 10) MIME types need to be parsed and serialized: text/html;charset= gbk
+PASS 11) MIME types need to be parsed and serialized: text/html;charset= "gbk"
PASS 12) MIME types need to be parsed and serialized: text/html;charset=gbk
PASS 13) MIME types need to be parsed and serialized: text/html;charset=gbk
PASS 14) MIME types need to be parsed and serialized: text/html;charset=gbk
PASS 15) MIME types need to be parsed and serialized: text/html;charset=gbk
-FAIL 16) MIME types need to be parsed and serialized: text/html;charset='gbk' assert_equals: expected "text/html;charset='gbk'" but got "text/html"
-FAIL 17) MIME types need to be parsed and serialized: text/html;charset='gbk assert_equals: expected "text/html;charset='gbk" but got "text/html"
-FAIL 18) MIME types need to be parsed and serialized: text/html;charset=gbk' assert_equals: expected "text/html;charset=gbk'" but got "text/html"
-FAIL 19) MIME types need to be parsed and serialized: text/html;charset=';charset=GBK assert_equals: expected "text/html;charset='" but got "text/html"
-FAIL 20) MIME types need to be parsed and serialized: text/html;test;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 21) MIME types need to be parsed and serialized: text/html;test=;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 22) MIME types need to be parsed and serialized: text/html;';charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 23) MIME types need to be parsed and serialized: text/html;";charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 24) MIME types need to be parsed and serialized: text/html ; ; charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 25) MIME types need to be parsed and serialized: text/html;;;;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 26) MIME types need to be parsed and serialized: text/html;charset= ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html"
-FAIL 27) MIME types need to be parsed and serialized: text/html;charset=";charset=foo";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html"
-FAIL 28) MIME types need to be parsed and serialized: text/html;charset="gbk" assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 29) MIME types need to be parsed and serialized: text/html;charset="gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 30) MIME types need to be parsed and serialized: text/html;charset=gbk" assert_equals: expected "text/html;charset=\"gbk\\\"\"" but got "text/html"
-FAIL 31) MIME types need to be parsed and serialized: text/html;charset=" gbk" assert_equals: expected "text/html;charset=\" gbk\"" but got "text/html"
-FAIL 32) MIME types need to be parsed and serialized: text/html;charset="gbk " assert_equals: expected "text/html;charset=\"gbk \"" but got "text/html"
-FAIL 33) MIME types need to be parsed and serialized: text/html;charset="\ gbk" assert_equals: expected "text/html;charset=\" gbk\"" but got "text/html"
-FAIL 34) MIME types need to be parsed and serialized: text/html;charset="\g\b\k" assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 35) MIME types need to be parsed and serialized: text/html;charset="gbk"x assert_equals: expected "text/html;charset=gbk" but got "text/html"
-FAIL 36) MIME types need to be parsed and serialized: text/html;charset="";charset=GBK assert_equals: expected "text/html;charset=\"\"" but got "text/html"
-FAIL 37) MIME types need to be parsed and serialized: text/html;charset=";charset=GBK assert_equals: expected "text/html;charset=\";charset=GBK\"" but got "text/html"
-FAIL 38) MIME types need to be parsed and serialized: text/html;charset={gbk} assert_equals: expected "text/html;charset=\"{gbk}\"" but got "text/html"
-FAIL 39) MIME types need to be parsed and serialized: text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk assert_equals: expected "text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk" but got "text/html"
+PASS 16) MIME types need to be parsed and serialized: text/html;charset='gbk'
+PASS 17) MIME types need to be parsed and serialized: text/html;charset='gbk
+PASS 18) MIME types need to be parsed and serialized: text/html;charset=gbk'
+PASS 19) MIME types need to be parsed and serialized: text/html;charset=';charset=GBK
+PASS 20) MIME types need to be parsed and serialized: text/html;test;charset=gbk
+PASS 21) MIME types need to be parsed and serialized: text/html;test=;charset=gbk
+PASS 22) MIME types need to be parsed and serialized: text/html;';charset=gbk
+PASS 23) MIME types need to be parsed and serialized: text/html;";charset=gbk
+PASS 24) MIME types need to be parsed and serialized: text/html ; ; charset=gbk
+PASS 25) MIME types need to be parsed and serialized: text/html;;;;charset=gbk
+FAIL 26) MIME types need to be parsed and serialized: text/html;charset= ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html;charset=gbk"
+FAIL 27) MIME types need to be parsed and serialized: text/html;charset=";charset=foo";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "text/html;charset=gbk"
+PASS 28) MIME types need to be parsed and serialized: text/html;charset="gbk"
+PASS 29) MIME types need to be parsed and serialized: text/html;charset="gbk
+PASS 30) MIME types need to be parsed and serialized: text/html;charset=gbk"
+PASS 31) MIME types need to be parsed and serialized: text/html;charset=" gbk"
+PASS 32) MIME types need to be parsed and serialized: text/html;charset="gbk "
+PASS 33) MIME types need to be parsed and serialized: text/html;charset="\ gbk"
+PASS 34) MIME types need to be parsed and serialized: text/html;charset="\g\b\k"
+PASS 35) MIME types need to be parsed and serialized: text/html;charset="gbk"x
+PASS 36) MIME types need to be parsed and serialized: text/html;charset="";charset=GBK
+FAIL 37) MIME types need to be parsed and serialized: text/html;charset=";charset=GBK assert_equals: expected "text/html;charset=\";charset=GBK\"" but got "text/html;charset=\";charset=gbk\""
+PASS 38) MIME types need to be parsed and serialized: text/html;charset={gbk}
+PASS 39) MIME types need to be parsed and serialized: text/html;0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789=x;charset=gbk
PASS 40) MIME types need to be parsed and serialized: 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-FAIL 41) MIME types need to be parsed and serialized: !#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz assert_equals: expected "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" but got "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
-FAIL 42) MIME types need to be parsed and serialized: x/x;x=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" assert_equals: expected "x/x;x=\"\t !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"" but got "x/x"
+FAIL 41) MIME types need to be parsed and serialized: !#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz assert_equals: expected "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" but got "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefg
hijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
+FAIL 42) MIME types need to be parsed and serialized: x/x;x=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" assert_equals: expected "x/x;x=\"\t !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\"" but got ""
PASS 43) MIME types need to be parsed and serialized: x/x;test
-FAIL 44) MIME types need to be parsed and serialized: x/x;test="\ assert_equals: expected "x/x;test=\"\\\\\"" but got "x/x"
+PASS 44) MIME types need to be parsed and serialized: x/x;test="\
PASS 45) MIME types need to be parsed and serialized: x/x;x=
PASS 46) MIME types need to be parsed and serialized: x/x;x=
-FAIL 47) MIME types need to be parsed and serialized: x/x
-\r ;x=x assert_equals: expected "x/x;x=x" but got ""
-FAIL 48) MIME types need to be parsed and serialized:
+PASS 47) MIME types need to be parsed and serialized: x/x
+\r ;x=x
+PASS 48) MIME types need to be parsed and serialized:
\r x/x;x=x
-\r assert_equals: expected "x/x;x=x" but got ""
-FAIL 49) MIME types need to be parsed and serialized: x/x;
+\r
+PASS 49) MIME types need to be parsed and serialized: x/x;
\r x=x
-\r ;x=y assert_equals: expected "x/x;x=x" but got "x/x"
-FAIL 50) MIME types need to be parsed and serialized: text/html;test=ÿ;charset=gbk assert_equals: expected "text/html;test=\"ÿ\";charset=gbk" but got "text/html"
-FAIL 51) MIME types need to be parsed and serialized: x/x;test=�;x=x assert_equals: expected "x/x;x=x" but got "x/x"
+\r ;x=y
+FAIL 50) MIME types need to be parsed and serialized: text/html;test=ÿ;charset=gbk assert_equals: expected "text/html;test=\"ÿ\";charset=gbk" but got ""
+PASS 51) MIME types need to be parsed and serialized: x/x;test=�;x=x
PASS 52) MIME types need to be parsed and serialized: x/x
PASS 53) MIME types need to be parsed and serialized: x/x
PASS 54) MIME types need to be parsed and serialized: x/x
Modified: trunk/Source/WebCore/ChangeLog (267958 => 267959)
--- trunk/Source/WebCore/ChangeLog 2020-10-05 09:46:39 UTC (rev 267958)
+++ trunk/Source/WebCore/ChangeLog 2020-10-05 10:30:33 UTC (rev 267959)
@@ -1,3 +1,26 @@
+2020-10-05 Rob Buis <rb...@igalia.com>
+
+ Make xhr.response more conforming to the specification
+ https://bugs.webkit.org/show_bug.cgi?id=217296
+
+ Reviewed by Darin Adler.
+
+ Make xhr.response more conforming to the specification when dealing
+ with Blob type responses, the type for the Blob should be computed
+ by the "get a final MIME type" algorithm [1, 2].
+
+ Behavior matches Firefox.
+
+ Test: imported/w3c/web-platform-tests/xhr/overridemimetype-blob.html
+
+ [1] https://xhr.spec.whatwg.org/#ref-for-final-mime-type③
+ [2] https://xhr.spec.whatwg.org/#final-mime-type
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::createResponseBlob):
+ (WebCore::XMLHttpRequest::responseMIMEType const):
+ * xml/XMLHttpRequest.h:
+
2020-10-04 Antoine Quint <grao...@webkit.org>
Add non-animated support for the CSS scale property
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (267958 => 267959)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2020-10-05 09:46:39 UTC (rev 267958)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2020-10-05 10:30:33 UTC (rev 267959)
@@ -209,7 +209,7 @@
if (m_binaryResponseBuilder)
data.append(m_binaryResponseBuilder->data(), m_binaryResponseBuilder->size());
m_binaryResponseBuilder = nullptr;
- String normalizedContentType = Blob::normalizedContentType(responseMIMEType()); // responseMIMEType defaults to text/xml which may be incorrect.
+ String normalizedContentType = Blob::normalizedContentType(responseMIMEType(FinalMIMEType::Yes)); // responseMIMEType defaults to text/xml which may be incorrect.
return Blob::create(scriptExecutionContext(), WTFMove(data), normalizedContentType);
}
@@ -842,21 +842,19 @@
return m_response.httpHeaderField(name);
}
-String XMLHttpRequest::responseMIMEType() const
+String XMLHttpRequest::responseMIMEType(FinalMIMEType finalMIMEType) const
{
- String mimeType = extractMIMETypeFromMediaType(m_mimeTypeOverride);
- if (mimeType.isEmpty()) {
+ String contentType = m_mimeTypeOverride;
+ if (contentType.isEmpty()) {
// Same logic as externalEntityMimeTypeAllowed() in XMLDocumentParserLibxml2.cpp. Keep them in sync.
- String contentType;
if (m_response.isInHTTPFamily())
contentType = m_response.httpHeaderField(HTTPHeaderName::ContentType);
else
contentType = m_response.mimeType();
- if (auto parsedContentType = ParsedContentType::create(contentType))
- return parsedContentType->mimeType();
- return "text/xml"_s;
}
- return mimeType;
+ if (auto parsedContentType = ParsedContentType::create(contentType))
+ return finalMIMEType == FinalMIMEType::Yes ? parsedContentType->serialize() : parsedContentType->mimeType();
+ return "text/xml"_s;
}
int XMLHttpRequest::status() const
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (267958 => 267959)
--- trunk/Source/WebCore/xml/XMLHttpRequest.h 2020-10-05 09:46:39 UTC (rev 267958)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h 2020-10-05 10:30:33 UTC (rev 267959)
@@ -90,7 +90,8 @@
String getResponseHeader(const String& name) const;
ExceptionOr<OwnedString> responseText();
String responseTextIgnoringResponseType() const { return m_responseBuilder.toStringPreserveCapacity(); }
- String responseMIMEType() const;
+ enum class FinalMIMEType { Yes, No };
+ String responseMIMEType(FinalMIMEType = FinalMIMEType::No) const;
Document* optionalResponseXML() const { return m_responseDocument.get(); }
ExceptionOr<Document*> responseXML();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes