- Revision
- 240591
- Author
- [email protected]
- Date
- 2019-01-28 11:11:54 -0800 (Mon, 28 Jan 2019)
Log Message
Update MIME type parser
https://bugs.webkit.org/show_bug.cgi?id=180526
Patch by Rob Buis <[email protected]> on 2019-01-28
Reviewed by Frédéric Wang.
LayoutTests/imported/w3c:
Update improved test expectations.
* web-platform-tests/xhr/overridemimetype-blob-expected.txt:
Source/WebCore:
I overlooked step 11.9.3 [1], for Mimesniff we should not
bail out on missing subtype, but keep trying. Note
that Rfc2045 does require bailing out, as before.
Test: ParsedContentType unittest
[1] https://mimesniff.spec.whatwg.org/#parse-a-mime-type
* platform/network/ParsedContentType.cpp:
(WebCore::parseToken):
(WebCore::parseContentType):
Tools:
* TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp:
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (240590 => 240591)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-01-28 19:11:54 UTC (rev 240591)
@@ -1,3 +1,14 @@
+2019-01-28 Rob Buis <[email protected]>
+
+ Update MIME type parser
+ https://bugs.webkit.org/show_bug.cgi?id=180526
+
+ Reviewed by Frédéric Wang.
+
+ Update improved test expectations.
+
+ * web-platform-tests/xhr/overridemimetype-blob-expected.txt:
+
2019-01-28 Oriol Brufau <[email protected]>
[css-logical] Reject unitless length quirk in 'inset' shorthand
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt (240590 => 240591)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt 2019-01-28 19:11:54 UTC (rev 240591)
@@ -18,7 +18,7 @@
FAIL 14) MIME types need to be parsed and serialized: text/html;charset=gbk' assert_equals: expected "text/html;charset=gbk'" but got "text/html"
FAIL 15) MIME types need to be parsed and serialized: text/html;charset=';charset=GBK assert_equals: expected "text/html;charset='" but got "text/html"
FAIL 16) 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 17) MIME types need to be parsed and serialized: text/html;test=;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "application/octet-stream"
+FAIL 17) 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 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=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
FAIL 20) MIME types need to be parsed and serialized: text/html ; ; charset=gbk assert_equals: expected "text/html;charset=gbk" but got "text/html"
Modified: trunk/Source/WebCore/ChangeLog (240590 => 240591)
--- trunk/Source/WebCore/ChangeLog 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/Source/WebCore/ChangeLog 2019-01-28 19:11:54 UTC (rev 240591)
@@ -1,3 +1,22 @@
+2019-01-28 Rob Buis <[email protected]>
+
+ Update MIME type parser
+ https://bugs.webkit.org/show_bug.cgi?id=180526
+
+ Reviewed by Frédéric Wang.
+
+ I overlooked step 11.9.3 [1], for Mimesniff we should not
+ bail out on missing subtype, but keep trying. Note
+ that Rfc2045 does require bailing out, as before.
+
+ Test: ParsedContentType unittest
+
+ [1] https://mimesniff.spec.whatwg.org/#parse-a-mime-type
+
+ * platform/network/ParsedContentType.cpp:
+ (WebCore::parseToken):
+ (WebCore::parseContentType):
+
2019-01-28 Michael Catanzaro <[email protected]>
Unreviewed follow-up to r240557, restore a call to makeString
Modified: trunk/Source/WebCore/platform/network/ParsedContentType.cpp (240590 => 240591)
--- trunk/Source/WebCore/platform/network/ParsedContentType.cpp 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/Source/WebCore/platform/network/ParsedContentType.cpp 2019-01-28 19:11:54 UTC (rev 240591)
@@ -264,6 +264,8 @@
valueRange = parseToken(contentType, index, isNotSemicolon, mode, mode == Mode::MimeSniff);
if (!valueRange) {
+ if (mode == Mode::MimeSniff)
+ continue;
LOG_ERROR("Invalid Content-Type, invalid parameter value.");
return false;
}
Modified: trunk/Tools/ChangeLog (240590 => 240591)
--- trunk/Tools/ChangeLog 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/Tools/ChangeLog 2019-01-28 19:11:54 UTC (rev 240591)
@@ -1,3 +1,13 @@
+2019-01-28 Rob Buis <[email protected]>
+
+ Update MIME type parser
+ https://bugs.webkit.org/show_bug.cgi?id=180526
+
+ Reviewed by Frédéric Wang.
+
+ * TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp:
+ (TestWebKitAPI::TEST):
+
2019-01-28 Zalan Bujtas <[email protected]>
[LFC][MarginCollapsing][Quirks] Quirk margin values get propagated through margin collapsing
Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp (240590 => 240591)
--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp 2019-01-28 19:09:40 UTC (rev 240590)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ParsedContentType.cpp 2019-01-28 19:11:54 UTC (rev 240591)
@@ -51,7 +51,8 @@
EXPECT_TRUE(isValidContentType("text/plain;test", Mode::MimeSniff));
EXPECT_TRUE(isValidContentType("text/plain; test", Mode::MimeSniff));
- EXPECT_FALSE(isValidContentType("text/plain;test=", Mode::MimeSniff));
+ EXPECT_TRUE(isValidContentType("text/plain;test=", Mode::MimeSniff));
+ EXPECT_TRUE(isValidContentType("text/plain;test=;test=value", Mode::MimeSniff));
EXPECT_TRUE(isValidContentType("text/plain;test=value", Mode::MimeSniff));
EXPECT_TRUE(isValidContentType("text/plain; test=value", Mode::MimeSniff));
EXPECT_TRUE(isValidContentType("text/plain;test =value", Mode::MimeSniff));
@@ -84,6 +85,7 @@
EXPECT_FALSE(isValidContentType("text/plain;test", Mode::Rfc2045));
EXPECT_FALSE(isValidContentType("text/plain; test", Mode::Rfc2045));
EXPECT_FALSE(isValidContentType("text/plain;test=", Mode::Rfc2045));
+ EXPECT_FALSE(isValidContentType("text/plain;test=;test=value", Mode::Rfc2045));
EXPECT_TRUE(isValidContentType("text/plain;test=value", Mode::Rfc2045));
EXPECT_TRUE(isValidContentType("text/plain; test=value", Mode::Rfc2045));
EXPECT_FALSE(isValidContentType("text/plain;test =value", Mode::Rfc2045));