WebKit Bugzilla
Attachment 348090 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-20180826172302.patch (text/plain), 8.32 KB, created by
Rob Buis
on 2018-08-26 08:23:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2018-08-26 08:23:04 PDT
Size:
8.32 KB
patch
obsolete
>Subversion Revision: 235338 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 302c942a8cb7e43d5dfc46d5cbb1895e79b4b176..40ec2b9cac9808ff18796de769959cee7e16c18e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+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..81f6699f83ff815125f9640de2ec6f5ccc44ccc2 100644 >--- a/Source/WebCore/xml/XMLHttpRequest.cpp >+++ b/Source/WebCore/xml/XMLHttpRequest.cpp >@@ -446,14 +446,17 @@ ExceptionOr<void> XMLHttpRequest::send(Document& document) > return WTFMove(result.value()); > > if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily()) { >- if (!m_requestHeaders.contains(HTTPHeaderName::ContentType)) { >+ String contentType = m_requestHeaders.get(HTTPHeaderName::ContentType); >+ if (contentType.isNull()) { > #if ENABLE(DASHBOARD_SUPPORT) > if (usesDashboardBackwardCompatibilityMode()) > 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 { >+ 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..d47a0889f680cc0812d3f94da714b1c76a9d8b4b 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/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!). >+ >+ * platform/mac/TestExpectations: >+ > 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..6f306fec4d0757a465e6686ca37bab621816dca8 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 >@@ -21,10 +21,10 @@ FAIL Blob request with set type respects setRequestHeader("") to be specified as > PASS Blob request with set type uses that it for Content-Type unless setRequestHeader() > PASS Blob request with set type keeps setRequestHeader() Content-Type and charset > FAIL ArrayBuffer request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n" >-FAIL ArrayBuffer request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: application/x-www-form-urlencoded\n" >+PASS ArrayBuffer request sends no Content-Type without setRequestHeader() call > PASS ArrayBuffer request keeps setRequestHeader() Content-Type and charset > FAIL ArrayBufferView request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n" >-FAIL ArrayBufferView request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: application/x-www-form-urlencoded\n" >+PASS ArrayBufferView request sends no Content-Type without setRequestHeader() call > PASS ArrayBufferView request keeps setRequestHeader() Content-Type and charset > FAIL FormData request respects setRequestHeader("") assert_equals: expected "Content-Type: \n" but got "Content-Type: \n" > PASS FormData request has correct default Content-Type of "multipart/form-data; boundary=_" >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 71375966e72f321a762e46d9ebcc216bd5a92777..666173252da900edb0e135fc6fcb3311b28d0b13 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1585,9 +1585,6 @@ webkit.org/b/172052 [ Debug ] imported/w3c/web-platform-tests/html/webappapis/ti > # <rdar://problem/32800095> REGRESSION: LayoutTest imported/blink/fast/gradients/gradient-transparency.html is failing > [ HighSierra+ ] imported/blink/fast/gradients/gradient-transparency.html [ ImageOnlyFailure ] > >-# <rdar://problem/32826391> LayoutTest imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm is failing on High Sierra >-[ HighSierra+ ] imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm [ Failure ] >- > # <rdar://problem/32864306> Unskip after bots have CTFontCopyPhysicalFont() > [ HighSierra+ ] fast/text/system-font-japanese-synthetic-italic.html [ Pass ImageOnlyFailure ] >
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