WebKit Bugzilla
Attachment 348099 Details for
Bug 188953
: XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188953-20180826212119.patch (text/plain), 12.25 KB, created by
Rob Buis
on 2018-08-26 12:21:20 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2018-08-26 12:21:20 PDT
Size:
12.25 KB
patch
obsolete
>Subversion Revision: 235338 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 302c942a8cb7e43d5dfc46d5cbb1895e79b4b176..272833cf7136c396a40efc50284b505b8cf5bcc8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-08-26 Rob Buis <rbuis@igalia.com> >+ >+ XMLHTTPRequest.send for Document should have same Content-Type processing rules like String >+ https://bugs.webkit.org/show_bug.cgi?id=188953 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Processing rules for Content-Type have been implemented for send with String as parameter, but >+ not for Document, but both 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-24 Ryosuke Niwa <rniwa@webkit.org> > > Click event from click() is not composed >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index fc1ab204728524a5043dd5f09e99f59041c4c160..b3b288abb98e6023054d6fc49757e9b1b8510dbf 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -452,8 +452,11 @@ ExceptionOr<void> XMLHttpRequest::send(Document& document) > m_requestHeaders.set(HTTPHeaderName::ContentType, "application/x-www-form-urlencoded"_s); > else > #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 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ff519068a297bd58d180b0f70dd1dda9c5b69c89..8c8815f964276e206d6af14a35adab2d587b3e19 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-26 Rob Buis <rbuis@igalia.com> >+ >+ XMLHTTPRequest.send for Document should have same Content-Type processing rules like String >+ https://bugs.webkit.org/show_bug.cgi?id=188953 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: >+ * platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: >+ * platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: >+ > 2018-08-24 Jer Noble <jer.noble@apple.com> > > Using Touch Bar to scrub video on Youtube results in video playback freeze >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 9764195f07f66bb047a7d551b745598a02145b68..5c4762fbdb90890192cfd6e40356edc515a65d58 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-26 Rob Buis <rbuis@igalia.com> >+ >+ XMLHTTPRequest.send for Document should have same Content-Type processing rules like String >+ https://bugs.webkit.org/show_bug.cgi?id=188953 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt: >+ > 2018-08-24 Ryosuke Niwa <rniwa@webkit.org> > > Click event from click() is not composed >diff --git a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >index c97aa8773c4c9b1042a59f441a9a0e3ed989e7ac..835ee2dd8a6d37b1b40459e21817088c6a32d468 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >@@ -10,10 +10,10 @@ PASS String request has correct default Content-Type of "text/plain;charset=UTF- > 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 >diff --git a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >index 8b504acc654f86d928478c2d7aa168ebda7e1258..6f306fec4d0757a465e6686ca37bab621816dca8 100644 >--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >@@ -10,10 +10,10 @@ PASS String request has correct default Content-Type of "text/plain;charset=UTF- > 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 >diff --git a/LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >index 41de5e6162c28541c55d948cd3853de7bb490c9c..453876ed09a0274b6bcd93f73ac7d1d52f862011 100644 >--- a/LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >@@ -10,10 +10,10 @@ PASS String request has correct default Content-Type of "text/plain;charset=UTF- > 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 >diff --git a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >index 8b504acc654f86d928478c2d7aa168ebda7e1258..6f306fec4d0757a465e6686ca37bab621816dca8 100644 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type-expected.txt >@@ -10,10 +10,10 @@ PASS String request has correct default Content-Type of "text/plain;charset=UTF- > 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
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 188953
:
348090
|
348092
|
348093
|
348094
|
348095
|
348096
|
348097
|
348099
|
348129
|
348135