- Revision
- 235360
- Author
- commit-qu...@webkit.org
- Date
- 2018-08-27 06:40:44 -0700 (Mon, 27 Aug 2018)
Log Message
XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
https://bugs.webkit.org/show_bug.cgi?id=188953
Patch by Rob Buis <rb...@igalia.com> on 2018-08-27
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
* web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
Source/WebCore:
Processing rules for Content-Type have been implemented for send with String as parameter, but
not for Document, but both should be treated the same according to the spec [1]. This patch
implements this.
Behavior matches Firefox.
[1] https://xhr.spec.whatwg.org/#the-send()-method
Test: web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):
LayoutTests:
* platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (235359 => 235360)
--- trunk/LayoutTests/ChangeLog 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/ChangeLog 2018-08-27 13:40:44 UTC (rev 235360)
@@ -1,3 +1,14 @@
+2018-08-27 Rob Buis <rb...@igalia.com>
+
+ XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
+ https://bugs.webkit.org/show_bug.cgi?id=188953
+
+ Reviewed by Darin Adler.
+
+ * platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
+ * platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
+ * platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
+
2018-08-27 Youenn Fablet <you...@apple.com>
Update WPT XHR tests to 87329a1
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (235359 => 235360)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2018-08-27 13:40:44 UTC (rev 235360)
@@ -1,3 +1,12 @@
+2018-08-27 Rob Buis <rb...@igalia.com>
+
+ XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
+ https://bugs.webkit.org/show_bug.cgi?id=188953
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
+
2018-08-27 Ali Juma <aj...@chromium.org>
[IntersectionObserver] Implement intersection logic for the explicit root case
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (235359 => 235360)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 13:40:44 UTC (rev 235360)
@@ -10,10 +10,10 @@
PASS String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL XML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"
-FAIL XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: application/xhtml+xml;charset=UTF-8\n" but got "Content-Type: application/xhtml+xml;charset=ASCII\n"
+PASS XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL HTML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"
-FAIL HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: text/html+junk;charset=UTF-8\n" but got "Content-Type: text/html+junk;charset=ASCII\n"
+PASS HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL Blob request respects setRequestHeader("") to be specified assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
FAIL Blob request with unset type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: \n"
PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (235359 => 235360)
--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 13:40:44 UTC (rev 235360)
@@ -10,10 +10,10 @@
PASS String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL XML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"
-FAIL XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: application/xhtml+xml;charset=UTF-8\n" but got "Content-Type: application/xhtml+xml;charset=ASCII\n"
+PASS XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL HTML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"
-FAIL HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: text/html+junk;charset=UTF-8\n" but got "Content-Type: text/html+junk;charset=ASCII\n"
+PASS HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL Blob request respects setRequestHeader("") to be specified assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
FAIL Blob request with unset type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: \n"
PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (235359 => 235360)
--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 13:40:44 UTC (rev 235360)
@@ -10,10 +10,10 @@
PASS String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
PASS XML Document request respects setRequestHeader("")
PASS XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"
-FAIL XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "content-type: application/xhtml+xml;charset=utf-8" but got "content-type: application/xhtml+xml;charset=ascii"
+PASS XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
PASS HTML Document request respects setRequestHeader("")
PASS HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"
-FAIL HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "content-type: text/html+junk;charset=utf-8" but got "content-type: text/html+junk;charset=ascii"
+PASS HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
PASS Blob request respects setRequestHeader("") to be specified
FAIL Blob request with unset type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "content-type: "
PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (235359 => 235360)
--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2018-08-27 13:40:44 UTC (rev 235360)
@@ -10,10 +10,10 @@
PASS String request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL XML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS XML Document request has correct default Content-Type of "application/xml;charset=UTF-8"
-FAIL XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: application/xhtml+xml;charset=UTF-8\n" but got "Content-Type: application/xhtml+xml;charset=ASCII\n"
+PASS XML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL HTML Document request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
PASS HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"
-FAIL HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8 assert_equals: expected "Content-Type: text/html+junk;charset=UTF-8\n" but got "Content-Type: text/html+junk;charset=ASCII\n"
+PASS HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
FAIL Blob request respects setRequestHeader("") to be specified assert_equals: expected "Content-Type: \n" but got "Content-Type: \n"
FAIL Blob request with unset type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: \n"
PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
Modified: trunk/Source/WebCore/ChangeLog (235359 => 235360)
--- trunk/Source/WebCore/ChangeLog 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/Source/WebCore/ChangeLog 2018-08-27 13:40:44 UTC (rev 235360)
@@ -1,3 +1,23 @@
+2018-08-27 Rob Buis <rb...@igalia.com>
+
+ XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
+ https://bugs.webkit.org/show_bug.cgi?id=188953
+
+ Reviewed by Darin Adler.
+
+ Processing rules for Content-Type have been implemented for send with String as parameter, but
+ not for Document, but both should be treated the same according to the spec [1]. This patch
+ implements this.
+
+ Behavior matches Firefox.
+
+ [1] https://xhr.spec.whatwg.org/#the-send()-method
+
+ Test: web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::send):
+
2018-08-27 Ali Juma <aj...@chromium.org>
[IntersectionObserver] Implement intersection logic for the explicit root case
Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (235359 => 235360)
--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2018-08-27 11:49:08 UTC (rev 235359)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2018-08-27 13:40:44 UTC (rev 235360)
@@ -461,6 +461,10 @@
#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);
}
// FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm