Diff
Modified: trunk/LayoutTests/ChangeLog (239039 => 239040)
--- trunk/LayoutTests/ChangeLog 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/ChangeLog 2018-12-10 20:31:18 UTC (rev 239040)
@@ -1,3 +1,15 @@
+2018-12-10 Rob Buis <[email protected]>
+
+ XMLHttpRequest removes spaces from content-types before processing
+ https://bugs.webkit.org/show_bug.cgi?id=8644
+
+ Reviewed by Chris Dumez.
+
+ Update improved test expectation and remove comment.
+
+ * http/tests/xmlhttprequest/supported-xml-content-types-expected.txt:
+ * http/tests/xmlhttprequest/supported-xml-content-types.html:
+
2018-12-09 Commit Queue <[email protected]>
Unreviewed, rolling out r239010.
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types-expected.txt (239039 => 239040)
--- trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types-expected.txt 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types-expected.txt 2018-12-10 20:31:18 UTC (rev 239040)
@@ -46,7 +46,7 @@
PASS -- testing: invalid -- responseXML: null
-FAIL (got document -- response type: foo bar/baz+xml) -- testing: foo bar/baz+xml -- responseXML: [object XMLDocument]
+PASS -- testing: foo bar/baz+xml -- responseXML: null
PASS -- testing: foo[bar/baz+xml -- responseXML: null
Modified: trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html (239039 => 239040)
--- trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html 2018-12-10 20:31:18 UTC (rev 239040)
@@ -65,8 +65,6 @@
// invalid types
testXMLType("invalid", false);
-// FIXME: our code intentionally skips spaces, that seems wrong to me.
-// https://bugs.webkit.org/show_bug.cgi?id=8644
testXMLType("foo bar/baz+xml", false);
testXMLType("foo[bar/baz+xml", false);
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (239039 => 239040)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-12-10 20:31:18 UTC (rev 239040)
@@ -1,3 +1,15 @@
+2018-12-10 Rob Buis <[email protected]>
+
+ XMLHttpRequest removes spaces from content-types before processing
+ https://bugs.webkit.org/show_bug.cgi?id=8644
+
+ Reviewed by Chris Dumez.
+
+ Update improved test expectations.
+
+ * web-platform-tests/mimesniff/mime-types/parsing.any-expected.txt:
+ * web-platform-tests/mimesniff/mime-types/parsing.any.worker-expected.txt:
+
2018-12-05 Youenn Fablet <[email protected]>
[iOS] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https.html is a flaky failure
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any-expected.txt (239039 => 239040)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any-expected.txt 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any-expected.txt 2018-12-10 20:31:18 UTC (rev 239040)
@@ -231,9 +231,9 @@
PASS x/x;x="
";bonus=x (Request/Response)
PASS /x (Blob/File)
-FAIL /x (Request/Response) assert_equals: expected "" but got "/x"
+PASS /x (Request/Response)
PASS x/ (Blob/File)
-FAIL x/ (Request/Response) assert_equals: expected "" but got "x/"
+PASS x/ (Request/Response)
FAIL x/x;=x;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;=x;bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
FAIL x/x;x=;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
@@ -241,9 +241,9 @@
FAIL x/x;x="";bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;x="";bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
PASS /x (Blob/File)
-FAIL /x (Request/Response) assert_equals: expected "" but got "/x"
+PASS /x (Request/Response)
PASS x/ (Blob/File)
-FAIL x/ (Request/Response) assert_equals: expected "" but got "x/"
+PASS x/ (Request/Response)
FAIL x/x;=x;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;=x;bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
FAIL x/x;x=;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any.worker-expected.txt (239039 => 239040)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any.worker-expected.txt 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mimesniff/mime-types/parsing.any.worker-expected.txt 2018-12-10 20:31:18 UTC (rev 239040)
@@ -231,9 +231,9 @@
PASS x/x;x="
";bonus=x (Request/Response)
FAIL /x (Blob/File) Can't find variable: File
-FAIL /x (Request/Response) assert_equals: expected "" but got "/x"
+PASS /x (Request/Response)
FAIL x/ (Blob/File) Can't find variable: File
-FAIL x/ (Request/Response) assert_equals: expected "" but got "x/"
+PASS x/ (Request/Response)
FAIL x/x;=x;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;=x;bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
FAIL x/x;x=;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
@@ -241,9 +241,9 @@
FAIL x/x;x="";bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;x="";bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
FAIL /x (Blob/File) Can't find variable: File
-FAIL /x (Request/Response) assert_equals: expected "" but got "/x"
+PASS /x (Request/Response)
FAIL x/ (Blob/File) Can't find variable: File
-FAIL x/ (Request/Response) assert_equals: expected "" but got "x/"
+PASS x/ (Request/Response)
FAIL x/x;=x;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
FAIL x/x;=x;bonus=x (Request/Response) assert_equals: expected "x/x;bonus=x" but got "x/x"
FAIL x/x;x=;bonus=x (Blob/File) assert_equals: Blob expected "x/x;bonus=x" but got ""
Modified: trunk/Source/WebCore/ChangeLog (239039 => 239040)
--- trunk/Source/WebCore/ChangeLog 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/Source/WebCore/ChangeLog 2018-12-10 20:31:18 UTC (rev 239040)
@@ -1,3 +1,26 @@
+2018-12-10 Rob Buis <[email protected]>
+
+ XMLHttpRequest removes spaces from content-types before processing
+ https://bugs.webkit.org/show_bug.cgi?id=8644
+
+ Reviewed by Chris Dumez.
+
+ Stop trimming white space characters from the middle of
+ type/subtype value. Also make sure whitespace being parsed
+ adheres to OWS definition from RFC 7230 Section 3.2.3
+ (referenced by RFC 7231), i.e. space or HT.
+
+ Based on http://crrev.com/416586.
+
+ Behavior matches Firefox and Chrome.
+
+ Tests: http/tests/xmlhttprequest/supported-xml-content-types.html
+ web-platform-tests/mimesniff/mime-types/parsing.any.html
+ web-platform-tests/mimesniff/mime-types/parsing.any.worker.html
+
+ * platform/network/HTTPParsers.cpp:
+ (WebCore::extractMIMETypeFromMediaType):
+
2018-12-10 Wenson Hsieh <[email protected]>
[iOS] Caret is obscured by finger when dragging over an editable element
Modified: trunk/Source/WebCore/platform/network/HTTPParsers.cpp (239039 => 239040)
--- trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2018-12-10 20:27:59 UTC (rev 239039)
+++ trunk/Source/WebCore/platform/network/HTTPParsers.cpp 2018-12-10 20:31:18 UTC (rev 239040)
@@ -301,15 +301,24 @@
String extractMIMETypeFromMediaType(const String& mediaType)
{
- StringBuilder mimeType;
+ unsigned position = 0;
unsigned length = mediaType.length();
- mimeType.reserveCapacity(length);
- for (unsigned i = 0; i < length; i++) {
- UChar c = mediaType[i];
- if (c == ';')
+ for (; position < length; ++position) {
+ UChar c = mediaType[position];
+ if (c != '\t' && c != ' ')
break;
+ }
+ if (position == length)
+ return mediaType;
+
+ unsigned typeStart = position;
+
+ unsigned typeEnd = position;
+ for (; position < length; ++position) {
+ UChar c = mediaType[position];
+
// While RFC 2616 does not allow it, other browsers allow multiple values in the HTTP media
// type header field, Content-Type. In such cases, the media type string passed here may contain
// the multiple values separated by commas. For now, this code ignores text after the first comma,
@@ -319,19 +328,13 @@
if (c == ',')
break;
- // FIXME: The following is not correct. RFC 2616 allows linear white space before and
- // after the MIME type, but not within the MIME type itself. And linear white space
- // includes only a few specific ASCII characters; a small subset of isSpaceOrNewline.
- // See https://bugs.webkit.org/show_bug.cgi?id=8644 for a bug tracking part of this.
- if (isSpaceOrNewline(c))
- continue;
+ if (c == '\t' || c == ' ' || c == ';')
+ break;
- mimeType.append(c);
+ typeEnd = position + 1;
}
- if (mimeType.length() == length)
- return mediaType;
- return mimeType.toString();
+ return mediaType.substring(typeStart, typeEnd - typeStart);
}
String extractCharsetFromMediaType(const String& mediaType)