WebKit Bugzilla
Attachment 348129 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-20180827114018.patch (text/plain), 11.87 KB, created by
Rob Buis
on 2018-08-27 02:40:19 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2018-08-27 02:40:19 PDT
Size:
11.87 KB
patch
obsolete
>Subversion Revision: 235357 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 11cb33ea1abf219350f43901ec46d1b277da7169..d9aa134bf48b5147664be643eddc7369789810ca 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-08-27 Rob Buis <rbuis@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 NOBODY (OOPS!). >+ >+ 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-25 Yusuke Suzuki <yusukesuzuki@slowstart.org> > > Shrink size of HTMLCollection >diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp >index 6e72c1638ced9e540917c09dac597f544fe84a68..25c904e7b62e02e0342c562d6c8b73a739d47689 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -461,6 +461,10 @@ 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); > } > > // FIXME: According to XMLHttpRequest Level 2, this should use the Document.innerHTML algorithm >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1282d3bcbafca2264b21c52b03684c1db1ab7b41..fca503349d558597c751e00b3579d99024142581 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-27 Rob Buis <rbuis@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 NOBODY (OOPS!). >+ >+ * 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 <youenn@apple.com> > > Update WPT XHR tests to 87329a1 >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index f560fa41f9caecec64ad9082413276a4c016c07c..89a481e3dc0af7b2d2f147751c4ee051cb9b6569 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,12 @@ >+2018-08-27 Rob Buis <rbuis@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 NOBODY (OOPS!). >+ >+ * web-platform-tests/xhr/setrequestheader-content-type-expected.txt: >+ > 2018-08-27 Youenn Fablet <youenn@apple.com> > > Update WPT XHR tests to 87329a1 >diff --git a/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >index c97aa8773c4c9b1042a59f441a9a0e3ed989e7ac..835ee2dd8a6d37b1b40459e21817088c6a32d468 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/xhr/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/xhr/setrequestheader-content-type-expected.txt b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >index 8b504acc654f86d928478c2d7aa168ebda7e1258..6f306fec4d0757a465e6686ca37bab621816dca8 100644 >--- a/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/xhr/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/xhr/setrequestheader-content-type-expected.txt b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >index 41de5e6162c28541c55d948cd3853de7bb490c9c..453876ed09a0274b6bcd93f73ac7d1d52f862011 100644 >--- a/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/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/xhr/setrequestheader-content-type-expected.txt b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >index 8b504acc654f86d928478c2d7aa168ebda7e1258..6f306fec4d0757a465e6686ca37bab621816dca8 100644 >--- a/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt >+++ b/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/xhr/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