WebKit Bugzilla
Attachment 357400 Details for
Bug 180526
: Update MIME type parser
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-180526-20181215144641.patch (text/plain), 29.32 KB, created by
Rob Buis
on 2018-12-15 05:46:43 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2018-12-15 05:46:43 PST
Size:
29.32 KB
patch
obsolete
>Subversion Revision: 239225 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 854ee33b41e81f2b845a701004e4be25b79f5d2b..21dd86687f6f3635a78d50e266694b205328fee7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2018-12-15 Rob Buis <rbuis@igalia.com> >+ >+ Update MIME type parser >+ https://bugs.webkit.org/show_bug.cgi?id=180526 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add an enum to allow two modes of MIME type parsing, one mode >+ to keep supporting RFC2045 as before, and one mode to support >+ the updated MIME parser from mimesniff [1]. Mimesniff support >+ brings the following changes: >+ - allows parameter names without matching =value. >+ - skips whitespace after parameter value token. >+ - lower cases MIME type and parameter name. >+ - parameter names parsed before are discarded. >+ >+ [1] https://mimesniff.spec.whatwg.org/ >+ >+ Test: web-platform-tests/xhr/overridemimetype-blob.html >+ >+ * platform/network/ParsedContentType.cpp: >+ (WebCore::DummyParsedContentType::setContentType const): >+ (WebCore::DummyParsedContentType::setContentTypeParameter const): >+ (WebCore::isQuotedStringTokenCharacter): >+ (WebCore::parseToken): >+ (WebCore::parseContentType): >+ (WebCore::isValidContentType): >+ (WebCore::ParsedContentType::ParsedContentType): >+ (WebCore::ParsedContentType::setContentType): >+ (WebCore::ParsedContentType::setContentTypeParameter): >+ * platform/network/ParsedContentType.h: >+ * xml/XMLHttpRequest.cpp: >+ (WebCore::XMLHttpRequest::send): >+ (WebCore::XMLHttpRequest::overrideMimeType): >+ > 2018-12-14 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (r233268): contents of an animated element inside overflow:hidden disappear >diff --git a/Source/WebCore/platform/network/ParsedContentType.cpp b/Source/WebCore/platform/network/ParsedContentType.cpp >index d729a05dbc0a528172a48ea9371cd8c51f3e1002..48fd6db72fdf1b3a00cd78dbaed013abc3d8ad02 100644 >--- a/Source/WebCore/platform/network/ParsedContentType.cpp >+++ b/Source/WebCore/platform/network/ParsedContentType.cpp >@@ -38,8 +38,8 @@ namespace WebCore { > > class DummyParsedContentType { > public: >- void setContentType(const SubstringRange&) const { } >- void setContentTypeParameter(const SubstringRange&, const SubstringRange&) const { } >+ void setContentType(const SubstringRange&, Mode) const { } >+ void setContentTypeParameter(const SubstringRange&, const SubstringRange&, Mode) const { } > }; > > static void skipSpaces(const String& input, unsigned& startIndex) >@@ -48,12 +48,19 @@ static void skipSpaces(const String& input, unsigned& startIndex) > ++startIndex; > } > >+static bool isQuotedStringTokenCharacter(unsigned short c) >+{ >+ return (c >= ' ' && c <= '~') || (c >= 0x80 && c <= 0xFF) || c == '\t'; >+} >+ > static bool isTokenCharacter(char c) > { > return isASCII(c) && c > ' ' && c != '"' && c != '(' && c != ')' && c != ',' && c != '/' && (c < ':' || c > '@') && (c < '[' || c > ']'); > } > >-static std::optional<SubstringRange> parseToken(const String& input, unsigned& startIndex) >+using ParseUntil = bool (*)(char); >+ >+static std::optional<SubstringRange> parseToken(const String& input, unsigned& startIndex, ParseUntil parseUntil, bool allowNonTokenCharacters = false) > { > unsigned inputLength = input.length(); > unsigned tokenStart = startIndex; >@@ -62,8 +69,8 @@ static std::optional<SubstringRange> parseToken(const String& input, unsigned& s > if (tokenEnd >= inputLength) > return std::nullopt; > >- while (tokenEnd < inputLength) { >- if (!isTokenCharacter(input[tokenEnd])) >+ while (tokenEnd < inputLength && !parseUntil(input[tokenEnd])) { >+ if (!allowNonTokenCharacters && !isTokenCharacter(input[tokenEnd])) > break; > ++tokenEnd; > } >@@ -152,7 +159,7 @@ static String substringForRange(const String& string, const SubstringRange& rang > // ; to use within parameter values > > template <class ReceiverType> >-bool parseContentType(const String& contentType, ReceiverType& receiver) >+bool parseContentType(const String& contentType, ReceiverType& receiver, Mode mode) > { > unsigned index = 0; > unsigned contentTypeLength = contentType.length(); >@@ -163,7 +170,7 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > } > > unsigned contentTypeStart = index; >- auto typeRange = parseToken(contentType, index); >+ auto typeRange = parseToken(contentType, index, [](char ch) { return ch == '/'; }); > if (!typeRange) { > LOG_ERROR("Invalid Content-Type, invalid type value."); > return false; >@@ -174,7 +181,7 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > return false; > } > >- auto subTypeRange = parseToken(contentType, index); >+ auto subTypeRange = parseToken(contentType, index, [](char ch) { return ch == ';'; }); > if (!subTypeRange) { > LOG_ERROR("Invalid Content-Type, invalid subtype value."); > return false; >@@ -183,24 +190,35 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > // There should not be any quoted strings until we reach the parameters. > size_t semiColonIndex = contentType.find(';', contentTypeStart); > if (semiColonIndex == notFound) { >- receiver.setContentType(SubstringRange(contentTypeStart, contentTypeLength - contentTypeStart)); >+ receiver.setContentType(SubstringRange(contentTypeStart, contentTypeLength - contentTypeStart), mode); > return true; > } > >- receiver.setContentType(SubstringRange(contentTypeStart, semiColonIndex - contentTypeStart)); >+ receiver.setContentType(SubstringRange(contentTypeStart, semiColonIndex - contentTypeStart), mode); > index = semiColonIndex + 1; > while (true) { > skipSpaces(contentType, index); >- auto keyRange = parseToken(contentType, index); >- if (!keyRange || index >= contentTypeLength) { >+ auto keyRange = parseToken(contentType, index, [](char ch) { return ch == ';' || ch == '='; }, mode == Mode::MimeSniff); >+ if (!keyRange || (mode == Mode::Rfc2045 && index >= contentTypeLength)) { > LOG_ERROR("Invalid Content-Type parameter name."); > return false; > } > > // Should we tolerate spaces here? >- if (contentType[index++] != '=' || index >= contentTypeLength) { >- LOG_ERROR("Invalid Content-Type malformed parameter."); >- return false; >+ if (mode == Mode::Rfc2045) { >+ if (contentType[index++] != '=' || index >= contentTypeLength) { >+ LOG_ERROR("Invalid Content-Type malformed parameter."); >+ return false; >+ } >+ } else { >+ if (index >= contentTypeLength) >+ break; >+ if (contentType[index] != '=' && contentType[index] != ';') { >+ LOG_ERROR("Invalid Content-Type malformed parameter."); >+ return false; >+ } >+ if (contentType[index++] == ';') >+ continue; > } > > // Should we tolerate spaces here? >@@ -208,21 +226,23 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > std::optional<SubstringRange> valueRange; > if (contentType[index] == '"') > valueRange = parseQuotedString(contentType, index); >- else >- valueRange = parseToken(contentType, index); >+ else { >+ valueRange = parseToken(contentType, index, [] (char ch) { return ch == ';'; }, mode == Mode::MimeSniff); >+ if (mode == Mode::MimeSniff) >+ skipSpaces(contentType, index); >+ } > > if (!valueRange) { > LOG_ERROR("Invalid Content-Type, invalid parameter value."); > return false; > } > >- // Should we tolerate spaces here? > if (index < contentTypeLength && contentType[index++] != ';') { > LOG_ERROR("Invalid Content-Type, invalid character at the end of key/value parameter."); > return false; > } > >- receiver.setContentTypeParameter(*keyRange, *valueRange); >+ receiver.setContentTypeParameter(*keyRange, *valueRange, mode); > > if (index >= contentTypeLength) > return true; >@@ -231,19 +251,19 @@ bool parseContentType(const String& contentType, ReceiverType& receiver) > return true; > } > >-bool isValidContentType(const String& contentType) >+bool isValidContentType(const String& contentType, Mode mode) > { > if (contentType.contains('\r') || contentType.contains('\n')) > return false; > > DummyParsedContentType parsedContentType = DummyParsedContentType(); >- return parseContentType<DummyParsedContentType>(contentType, parsedContentType); >+ return parseContentType<DummyParsedContentType>(contentType, parsedContentType, mode); > } > >-ParsedContentType::ParsedContentType(const String& contentType) >+ParsedContentType::ParsedContentType(const String& contentType, Mode mode) > : m_contentType(contentType.stripWhiteSpace()) > { >- parseContentType<ParsedContentType>(m_contentType, *this); >+ parseContentType<ParsedContentType>(m_contentType, *this, mode); > } > > String ParsedContentType::charset() const >@@ -261,14 +281,24 @@ size_t ParsedContentType::parameterCount() const > return m_parameters.size(); > } > >-void ParsedContentType::setContentType(const SubstringRange& contentRange) >+void ParsedContentType::setContentType(const SubstringRange& contentRange, Mode mode) > { > m_mimeType = substringForRange(m_contentType, contentRange).stripWhiteSpace(); >+ if (mode == Mode::MimeSniff) >+ m_mimeType.convertToASCIILowercase(); > } > >-void ParsedContentType::setContentTypeParameter(const SubstringRange& key, const SubstringRange& value) >+void ParsedContentType::setContentTypeParameter(const SubstringRange& key, const SubstringRange& value, Mode mode) > { >- m_parameters.set(substringForRange(m_contentType, key), substringForRange(m_contentType, value)); >+ String keyName = substringForRange(m_contentType, key); >+ String keyValue = substringForRange(m_contentType, value); >+ if (mode == Mode::MimeSniff) { >+ if (keyName.find([](unsigned short ch) { return !isTokenCharacter(ch); }) != notFound || >+ keyValue.find([](unsigned short ch) { return !isQuotedStringTokenCharacter(ch); }) != notFound || m_parameters.contains(keyName)) >+ return; >+ keyName.convertToASCIILowercase(); >+ } >+ m_parameters.set(keyName, keyValue); > } > > } >diff --git a/Source/WebCore/platform/network/ParsedContentType.h b/Source/WebCore/platform/network/ParsedContentType.h >index 6363b3e4d63587890a3cc8c11c56890abd19d0ee..aed5020d73cd283c4b643317cb4bb45ab81250be 100644 >--- a/Source/WebCore/platform/network/ParsedContentType.h >+++ b/Source/WebCore/platform/network/ParsedContentType.h >@@ -36,14 +36,18 @@ > > namespace WebCore { > >+enum class Mode { >+ Rfc2045, >+ MimeSniff >+}; > // <index, length> > typedef std::pair<unsigned, unsigned> SubstringRange; >-bool isValidContentType(const String&); >+bool isValidContentType(const String&, Mode = Mode::Rfc2045); > > // FIXME: add support for comments. > class ParsedContentType { > public: >- explicit ParsedContentType(const String&); >+ explicit ParsedContentType(const String&, Mode = Mode::Rfc2045); > > String mimeType() const { return m_mimeType; } > String charset() const; >@@ -54,9 +58,9 @@ public: > > private: > template<class ReceiverType> >- friend bool parseContentType(const String&, ReceiverType&); >- void setContentType(const SubstringRange&); >- void setContentTypeParameter(const SubstringRange&, const SubstringRange&); >+ friend bool parseContentType(const String&, ReceiverType&, Mode); >+ void setContentType(const SubstringRange&, Mode); >+ void setContentTypeParameter(const SubstringRange&, const SubstringRange&, Mode); > > typedef HashMap<String, String> KeyValuePairs; > String m_contentType; >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index b9eccf352fa940749e671dfef6e6f8e7b0905a18..7e09876439af78e19943279b3b6aaa2286b8d8b3 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -466,6 +466,7 @@ ExceptionOr<void> XMLHttpRequest::send(Document& document) > return WTFMove(result.value()); > > if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily()) { >+ String contentType = m_requestHeaders.get(HTTPHeaderName::ContentType); > if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) { > #if ENABLE(DASHBOARD_SUPPORT) > if (usesDashboardBackwardCompatibilityMode()) >@@ -474,10 +475,12 @@ ExceptionOr<void> XMLHttpRequest::send(Document& document) > #endif > // FIXME: this should include the charset used for encoding. > m_requestHeaders.set(HTTPHeaderName::ContentType, document.isHTMLDocument() ? "text/html;charset=UTF-8"_s : "application/xml;charset=UTF-8"_s); >- } else { >- String contentType = m_requestHeaders.get(HTTPHeaderName::ContentType); >- replaceCharsetInMediaType(contentType, "UTF-8"); >- m_requestHeaders.set(HTTPHeaderName::ContentType, contentType); >+ } else if (isValidContentType(contentType, Mode::MimeSniff)) { >+ ParsedContentType parsedContentType(contentType, Mode::MimeSniff); >+ if (!equalIgnoringASCIICase(parsedContentType.charset(), "UTF-8")) { >+ replaceCharsetInMediaType(contentType, "UTF-8"); >+ m_requestHeaders.set(HTTPHeaderName::ContentType, contentType); >+ } > } > > // FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm >@@ -504,9 +507,12 @@ ExceptionOr<void> XMLHttpRequest::send(const String& body) > else > #endif > m_requestHeaders.set(HTTPHeaderName::ContentType, HTTPHeaderValues::textPlainContentType()); >- } else { >- replaceCharsetInMediaType(contentType, "UTF-8"); >- m_requestHeaders.set(HTTPHeaderName::ContentType, contentType); >+ } else if (isValidContentType(contentType, Mode::MimeSniff)) { >+ ParsedContentType parsedContentType(contentType, Mode::MimeSniff); >+ if (!equalIgnoringASCIICase(parsedContentType.charset(), "UTF-8")) { >+ replaceCharsetInMediaType(contentType, "UTF-8"); >+ m_requestHeaders.set(HTTPHeaderName::ContentType, contentType); >+ } > } > > m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, UnencodableHandling::Entities)); >@@ -525,7 +531,7 @@ ExceptionOr<void> XMLHttpRequest::send(Blob& body) > if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily()) { > if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) { > const String& blobType = body.type(); >- if (!blobType.isEmpty() && isValidContentType(blobType)) >+ if (!blobType.isEmpty() && isValidContentType(blobType, Mode::MimeSniff)) > m_requestHeaders.set(HTTPHeaderName::ContentType, blobType); > else { > // From FileAPI spec, whenever media type cannot be determined, empty string must be returned. >@@ -785,7 +791,7 @@ ExceptionOr<void> XMLHttpRequest::overrideMimeType(const String& mimeType) > return Exception { InvalidStateError }; > > m_mimeTypeOverride = "application/octet-stream"_s; >- if (isValidContentType(mimeType)) >+ if (isValidContentType(mimeType, Mode::MimeSniff)) > m_mimeTypeOverride = mimeType; > > return { }; >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 01c2d41247e151b14c86d6c20bc42a80a47623e2..e7fce63205a4a42c4d933db30620eb810a6aa9b3 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,13 @@ >+2018-12-15 Rob Buis <rbuis@igalia.com> >+ >+ Update MIME type parser >+ https://bugs.webkit.org/show_bug.cgi?id=180526 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/xhr/overridemimetype-blob-expected.txt: >+ * web-platform-tests/xhr/send-content-type-charset-expected.txt: >+ > 2018-12-13 Youenn Fablet <youenn@apple.com> > > RTCRtpTransceiver.stopped should be true when applying a remote description with the corresponding m section rejected >diff --git a/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt >index 02561ca2e3f97639025137c90de8837a1b1d306b..8139d1a48c723d41b46a61df57afab91f0902d99 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/xhr/overridemimetype-blob-expected.txt >@@ -4,30 +4,30 @@ 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 "application/octet-stream" >-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 "application/octet-stream" >+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 "application/octet-stream" >-FAIL 7) MIME types need to be parsed and serialized: text/html;charset =gbk assert_equals: expected "text/html" but got "application/octet-stream" >+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 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 "application/octet-stream" >-FAIL 11) MIME types need to be parsed and serialized: text/html;charset= "gbk" assert_equals: expected "text/html;charset=\" \\\"gbk\\"\"" but got "application/octet-stream" >+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" > FAIL 12) MIME types need to be parsed and serialized: text/html;charset='gbk' assert_equals: expected "text/html;charset='gbk'" but got "text/html" > FAIL 13) MIME types need to be parsed and serialized: text/html;charset='gbk assert_equals: expected "text/html;charset='gbk" but got "text/html" > 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 "application/octet-stream" >+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 18) MIME types need to be parsed and serialized: text/html;';charset=gbk assert_equals: expected "text/html;charset=gbk" but got "application/octet-stream" >-FAIL 19) MIME types need to be parsed and serialized: text/html;";charset=gbk assert_equals: expected "text/html;charset=gbk" but got "application/octet-stream" >+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 "application/octet-stream" > FAIL 21) MIME types need to be parsed and serialized: text/html;;;;charset=gbk assert_equals: expected "text/html;charset=gbk" but got "application/octet-stream" >-FAIL 22) MIME types need to be parsed and serialized: text/html;charset= ";charset=GBK assert_equals: expected "text/html;charset=GBK" but got "application/octet-stream" >+FAIL 22) 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 23) 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 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 "application/octet-stream" >-FAIL 26) MIME types need to be parsed and serialized: text/html;charset=gbk" assert_equals: expected "text/html;charset=\"gbk\\\"\"" but got "application/octet-stream" >+FAIL 26) MIME types need to be parsed and serialized: text/html;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=" 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" >@@ -40,12 +40,12 @@ FAIL 35) MIME types need to be parsed and serialized: text/html;0123456789012345 > PASS 36) MIME types need to be parsed and serialized: 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789/0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 > FAIL 37) MIME types need to be parsed and serialized: !#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz assert_equals: expected "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz;!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz=!#$%&'*+-.^_`|~0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" but got "!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz/!#$%&'*+-.^_`|~0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" > FAIL 38) 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 39) MIME types need to be parsed and serialized: x/x;test assert_equals: expected "x/x" but got "application/octet-stream" >+PASS 39) MIME types need to be parsed and serialized: x/x;test > FAIL 40) MIME types need to be parsed and serialized: x/x;test="\ assert_equals: expected "x/x;test=\"\\\\"" but got "application/octet-stream" >-FAIL 41) MIME types need to be parsed and serialized: x/x;x= assert_equals: expected "x/x" but got "application/octet-stream" >-FAIL 42) MIME types need to be parsed and serialized: x/x;x= assert_equals: expected "x/x" but got "application/octet-stream" >-FAIL 43) MIME types need to be parsed and serialized: text/html;test=ÿ;charset=gbk assert_equals: expected "text/html;test=\"ÿ\";charset=gbk" but got "application/octet-stream" >-FAIL 44) MIME types need to be parsed and serialized: x/x;test=�;x=x assert_equals: expected "x/x;x=x" but got "application/octet-stream" >+PASS 41) MIME types need to be parsed and serialized: x/x;x= >+PASS 42) MIME types need to be parsed and serialized: x/x;x= >+FAIL 43) 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 44) MIME types need to be parsed and serialized: x/x;test=�;x=x assert_equals: expected "x/x;x=x" but got "x/x" > PASS 45) MIME types need to be parsed and serialized: > PASS 46) MIME types need to be parsed and serialized: > PASS 47) MIME types need to be parsed and serialized: / >diff --git a/LayoutTests/imported/w3c/web-platform-tests/xhr/send-content-type-charset-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/xhr/send-content-type-charset-expected.txt >index d0a66a65416b8100f501a3d34dd480e0b7eb143a..59e51a899f659b27bf3f81c6052cde1f5ed08f9a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/xhr/send-content-type-charset-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/xhr/send-content-type-charset-expected.txt >@@ -1,19 +1,19 @@ > >-FAIL header with invalid MIME type is not changed assert_equals: expected "text; charset=ascii" but got "text; charset=UTF-8" >+PASS header with invalid MIME type is not changed > PASS header with invalid MIME type (empty string) is not changed > PASS known charset but bogus header - missing MIME type > PASS bogus charset and bogus header - missing MIME type >-FAIL If charset= param is UTF-8 (case-insensitive), it should not be changed assert_equals: expected "text/plain;charset=utf-8" but got "text/plain;charset=UTF-8" >+PASS If charset= param is UTF-8 (case-insensitive), it should not be changed > PASS If no charset= param is given, implementation should not add one - unknown MIME > PASS If no charset= param is given, implementation should not add one - known MIME > PASS If no charset= param is given, implementation should not add one - known MIME, unknown param, two spaces > FAIL charset given but wrong, fix it (unknown MIME, bogus charset) assert_equals: expected "text/x-thepiano;charset=UTF-8" but got "text/x-thepiano;charset= UTF-8" >-FAIL If charset= param is UTF-8 (case-insensitive), it should not be changed (bogus charset) assert_equals: expected "text/plain;charset=utf-8;charset=waddup" but got "text/plain;charset=UTF-8;charset=UTF-8" >+PASS If charset= param is UTF-8 (case-insensitive), it should not be changed (bogus charset) > PASS charset given but wrong, fix it (known MIME, actual charset) > FAIL Multiple non-UTF-8 charset parameters deduplicate, bogus parameter dropped assert_equals: expected "text/x-pink-unicorn;charset=UTF-8" but got "text/x-pink-unicorn; charset=UTF-8; charset=UTF-8; notrelated; charset=UTF-8" > PASS No content type set, give MIME and charset > FAIL charset with space that is UTF-8 does not change assert_equals: expected "text/plain;charset= utf-8" but got "text/plain;charset= UTF-8" >-FAIL charset in double quotes that is UTF-8 does not change assert_equals: expected "text/plain;charset=\"utf-8\"" but got "text/plain;charset=\"UTF-8\"" >+PASS charset in double quotes that is UTF-8 does not change > FAIL charset in double quotes with space assert_equals: expected "text/plain;charset=UTF-8" but got "text/plain;charset=\" UTF-8\"" > FAIL charset in double quotes with backslashes that is UTF-8 does not change assert_equals: expected "text/plain;charset=\"u\\t\f-8\"" but got "text/plain;charset=\"UTF-8\"" > FAIL unknown parameters need to be preserved assert_equals: expected "yo/yo;charset=UTF-8;yo=YO;x=y" but got "YO/yo;charset=UTF-8;yo=YO; X=y"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 180526
:
348014
|
356923
|
356928
|
357400
|
357401
|
357403
|
357443
|
357469
|
357682
|
357684
|
357687
|
357690
|
357691
|
357702
|
358515
|
358898
|
358906
|
358907
|
358917
|
359860
|
360118
|
360123
|
360129
|
360134
|
360136
|
360144
|
360303
|
360343
|
360350
|
360355
|
362245
|
362316
|
362323
|
362342
|
362348
|
362360
|
362378
|
362384
|
362387
|
362390
|
362397
|
362416
|
362418
|
362430
|
362437
|
362483
|
362486
|
362497
|
362506
|
362526
|
390349