Changeset 249361 in webkit
- Timestamp:
- Aug 31, 2019 3:16:40 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249360 r249361 1 2019-08-31 Rob Buis <rbuis@igalia.com> 2 3 XMLHttpRequest: responseXML returns null if the Content-Type is valid (end in +xml) in some cases 4 https://bugs.webkit.org/show_bug.cgi?id=46146 5 6 Reviewed by Youenn Fablet. 7 8 Adjust test to match the specification: make response MIME type fallback to 9 text/xml in case mimeType could not be extracted. 10 11 Behavior matches Firefox. 12 13 * http/tests/xmlhttprequest/supported-xml-content-types-expected.txt: 14 * http/tests/xmlhttprequest/supported-xml-content-types.html: 15 1 16 2019-08-31 Frederic Wang <fwang@igalia.com> 2 17 -
trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types-expected.txt
r239040 r249361 41 41 PASS -- testing: foo*bar/baz+xml -- responseXML: [object XMLDocument] 42 42 43 PASS -- testing: foo bar/baz+xml -- responseXML: [object XMLDocument] 44 45 PASS -- testing: foo[bar/baz+xml -- responseXML: [object XMLDocument] 46 47 PASS -- testing: foo]bar/baz+xml -- responseXML: [object XMLDocument] 48 49 PASS -- testing: foo(bar/baz+xml -- responseXML: [object XMLDocument] 50 51 PASS -- testing: foo)bar/baz+xml -- responseXML: [object XMLDocument] 52 53 PASS -- testing: foo 54 55 PASS -- testing: foo>bar/baz+xml -- responseXML: [object XMLDocument] 56 57 PASS -- testing: foo@bar/baz+xml -- responseXML: [object XMLDocument] 58 59 PASS -- testing: foo,bar/baz+xml -- responseXML: [object XMLDocument] 60 61 PASS -- testing: foo;bar/baz+xml -- responseXML: [object XMLDocument] 62 63 PASS -- testing: foo:bar/baz+xml -- responseXML: [object XMLDocument] 64 65 PASS -- testing: foo\bar/baz+xml -- responseXML: [object XMLDocument] 66 67 PASS -- testing: foo"bar/baz+xml -- responseXML: [object XMLDocument] 68 69 PASS -- testing: foo/bar/baz+xml -- responseXML: [object XMLDocument] 70 71 PASS -- testing: foo?bar/baz+xml -- responseXML: [object XMLDocument] 72 73 PASS -- testing: foo=bar/baz+xml -- responseXML: [object XMLDocument] 74 75 PASS -- testing: invalid -- responseXML: [object XMLDocument] 76 43 77 PASS -- testing: text/html -- responseXML: null 44 78 45 79 PASS -- testing: image/png -- responseXML: null 46 47 PASS -- testing: invalid -- responseXML: null48 49 PASS -- testing: foo bar/baz+xml -- responseXML: null50 51 PASS -- testing: foo[bar/baz+xml -- responseXML: null52 53 PASS -- testing: foo]bar/baz+xml -- responseXML: null54 55 PASS -- testing: foo(bar/baz+xml -- responseXML: null56 57 PASS -- testing: foo)bar/baz+xml -- responseXML: null58 59 PASS -- testing: foo60 61 PASS -- testing: foo>bar/baz+xml -- responseXML: null62 63 PASS -- testing: foo@bar/baz+xml -- responseXML: null64 65 PASS -- testing: foo,bar/baz+xml -- responseXML: null66 67 PASS -- testing: foo;bar/baz+xml -- responseXML: null68 69 PASS -- testing: foo:bar/baz+xml -- responseXML: null70 71 PASS -- testing: foo\bar/baz+xml -- responseXML: null72 73 PASS -- testing: foo"bar/baz+xml -- responseXML: null74 75 PASS -- testing: foo/bar/baz+xml -- responseXML: null76 77 PASS -- testing: foo?bar/baz+xml -- responseXML: null78 79 PASS -- testing: foo=bar/baz+xml -- responseXML: null -
trunk/LayoutTests/http/tests/xmlhttprequest/supported-xml-content-types.html
r239040 r249361 57 57 testXMLType("foo&bar/baz+xml", true); 58 58 testXMLType("foo*bar/baz+xml", true); 59 testXMLType("foo bar/baz+xml", true); 60 testXMLType("foo[bar/baz+xml", true); 61 testXMLType("foo]bar/baz+xml", true); 62 testXMLType("foo(bar/baz+xml", true); 63 testXMLType("foo)bar/baz+xml", true); 64 testXMLType("foo<bar/baz+xml", true); 65 testXMLType("foo>bar/baz+xml", true); 66 testXMLType("foo@bar/baz+xml", true); 67 testXMLType("foo,bar/baz+xml", true); 68 testXMLType("foo;bar/baz+xml", true); 69 testXMLType("foo:bar/baz+xml", true); 70 testXMLType("foo\\bar/baz+xml", true); 71 testXMLType('foo"bar/baz+xml', true); 72 testXMLType("foo/bar/baz+xml", true); 73 testXMLType("foo?bar/baz+xml", true); 74 testXMLType("foo=bar/baz+xml", true); 75 76 testXMLType("invalid", true); 59 77 60 78 // non-xml types … … 62 80 testXMLType("image/png", false); 63 81 64 65 // invalid types66 testXMLType("invalid", false);67 68 testXMLType("foo bar/baz+xml", false);69 70 testXMLType("foo[bar/baz+xml", false);71 testXMLType("foo]bar/baz+xml", false);72 testXMLType("foo(bar/baz+xml", false);73 testXMLType("foo)bar/baz+xml", false);74 testXMLType("foo<bar/baz+xml", false);75 testXMLType("foo>bar/baz+xml", false);76 testXMLType("foo@bar/baz+xml", false);77 testXMLType("foo,bar/baz+xml", false);78 testXMLType("foo;bar/baz+xml", false);79 testXMLType("foo:bar/baz+xml", false);80 testXMLType("foo\\bar/baz+xml", false);81 testXMLType('foo"bar/baz+xml', false);82 testXMLType("foo/bar/baz+xml", false);83 testXMLType("foo?bar/baz+xml", false);84 testXMLType("foo=bar/baz+xml", false);85 86 82 </script> -
trunk/LayoutTests/imported/w3c/ChangeLog
r249360 r249361 1 2019-08-31 Rob Buis <rbuis@igalia.com> 2 3 XMLHttpRequest: responseXML returns null if the Content-Type is valid (end in +xml) in some cases 4 https://bugs.webkit.org/show_bug.cgi?id=46146 5 6 Reviewed by Youenn Fablet. 7 8 Updated expected result. 9 10 * web-platform-tests/xhr/responsexml-media-type-expected.txt: 11 1 12 2019-08-31 Frederic Wang <fwang@igalia.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/responsexml-media-type-expected.txt
r235354 r249361 2 2 PASS XMLHttpRequest: responseXML MIME type tests ('', should parse) 3 3 PASS XMLHttpRequest: responseXML MIME type tests ('text/html', should not parse) 4 FAIL XMLHttpRequest: responseXML MIME type tests ('bogus', should parse) null is not an object (evaluating 'client.responseXML.documentElement') 5 FAIL XMLHttpRequest: responseXML MIME type tests ('bogus+xml', should parse) null is not an object (evaluating 'client.responseXML.documentElement') 4 PASS XMLHttpRequest: responseXML MIME type tests ('bogus', should parse) 5 PASS XMLHttpRequest: responseXML MIME type tests ('bogus+xml', should parse) 6 6 PASS XMLHttpRequest: responseXML MIME type tests ('text/plain;+xml', should not parse) 7 7 PASS XMLHttpRequest: responseXML MIME type tests ('text/plainxml', should not parse) … … 9 9 PASS XMLHttpRequest: responseXML MIME type tests ('video/x-awesome', should not parse) 10 10 PASS XMLHttpRequest: responseXML MIME type tests ('text/xml', should parse) 11 FAIL XMLHttpRequest: responseXML MIME type tests ('application', should parse) null is not an object (evaluating 'client.responseXML.documentElement') 11 PASS XMLHttpRequest: responseXML MIME type tests ('application', should parse) 12 12 FAIL XMLHttpRequest: responseXML MIME type tests ('text/xsl', should not parse) assert_equals: expected null but got Document node with 1 child 13 13 PASS XMLHttpRequest: responseXML MIME type tests ('text/plain', should not parse) -
trunk/Source/WebCore/ChangeLog
r249360 r249361 1 2019-08-31 Rob Buis <rbuis@igalia.com> 2 3 XMLHttpRequest: responseXML returns null if the Content-Type is valid (end in +xml) in some cases 4 https://bugs.webkit.org/show_bug.cgi?id=46146 5 6 Reviewed by Youenn Fablet. 7 8 Make response MIME type fallback to text/xml in case mimeType could 9 not be extracted [1] and use the stricter ParsedContentType for that. 10 11 Behavior matches Firefox. 12 13 Test: web-platform-tests/xhr/responsexml-media-type.htm 14 15 [1] https://xhr.spec.whatwg.org/#response-mime-type 16 17 * xml/XMLHttpRequest.cpp: 18 (WebCore::XMLHttpRequest::responseMIMEType const): 19 1 20 2019-08-31 Frederic Wang <fwang@igalia.com> 2 21 -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r248846 r249361 842 842 String mimeType = extractMIMETypeFromMediaType(m_mimeTypeOverride); 843 843 if (mimeType.isEmpty()) { 844 String contentType; 844 845 if (m_response.isHTTP()) 845 mimeType = extractMIMETypeFromMediaType(m_response.httpHeaderField(HTTPHeaderName::ContentType));846 contentType = m_response.httpHeaderField(HTTPHeaderName::ContentType); 846 847 else 847 mimeType = m_response.mimeType(); 848 if (mimeType.isEmpty()) 849 mimeType = "text/xml"_s; 848 contentType = m_response.mimeType(); 849 if (auto parsedContentType = ParsedContentType::create(contentType)) 850 return parsedContentType->mimeType(); 851 return "text/xml"_s; 850 852 } 851 853 return mimeType;
Note: See TracChangeset
for help on using the changeset viewer.