<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279380] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279380">279380</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-06-29 12:07:43 -0700 (Tue, 29 Jun 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
https://bugs.webkit.org/show_bug.cgi?id=227477

Patch by Alex Christensen <achristensen@webkit.org> on 2021-06-29
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/xhr/setrequestheader-content-type-expected.txt:

Source/WebCore:

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::send):
* xml/XMLHttpRequest.h:
* xml/XMLHttpRequest.idl:

LayoutTests:

* platform/ios-wk2/TestExpectations:
* platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Removed.
* platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Added.
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformioswk2TestExpectations">trunk/LayoutTests/platform/ios-wk2/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequesth">trunk/Source/WebCore/xml/XMLHttpRequest.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestidl">trunk/Source/WebCore/xml/XMLHttpRequest.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt">trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformiosimportedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt">trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/ChangeLog 2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2021-06-29  Alex Christensen  <achristensen@webkit.org>
+
+        xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=227477
+
+        Reviewed by Chris Dumez.
+
+        * platform/ios-wk2/TestExpectations:
+        * platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Removed.
+        * platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt: Added.
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2021-06-24  Jer Noble  <jer.noble@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Loading WebM hangs if server sends only small amount of data
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/imported/w3c/ChangeLog    2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2021-06-29  Alex Christensen  <achristensen@webkit.org>
+
+        xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=227477
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/xhr/setrequestheader-content-type-expected.txt:
+
</ins><span class="cx"> 2021-06-29  Martin Robinson  <mrobinson@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         CSS scroll snap should allow scrolling to the middle of snap areas that overflow the snapport
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt 2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt    2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -12,24 +12,21 @@
</span><span class="cx"> PASS HTML Document request has correct default Content-Type of "text/html;charset=UTF-8"
</span><span class="cx"> PASS HTML Document request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
</span><span class="cx"> PASS Blob request respects setRequestHeader("") to be specified
</span><del>-FAIL Blob request with unset type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: \n"
</del><ins>+PASS Blob request with unset type sends no Content-Type without setRequestHeader() call
</ins><span class="cx"> PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
</span><span class="cx"> PASS Blob request with set type respects setRequestHeader("") to be specified
</span><span class="cx"> PASS Blob request with set type uses that it for Content-Type unless setRequestHeader()
</span><span class="cx"> PASS Blob request with set type keeps setRequestHeader() Content-Type and charset
</span><span class="cx"> PASS ArrayBuffer request respects setRequestHeader("")
</span><del>-FAIL ArrayBuffer request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: application/x-www-form-urlencoded\n"
</del><ins>+PASS ArrayBuffer request sends no Content-Type without setRequestHeader() call
</ins><span class="cx"> PASS ArrayBuffer request keeps setRequestHeader() Content-Type and charset
</span><span class="cx"> PASS ArrayBufferView request respects setRequestHeader("")
</span><del>-FAIL ArrayBufferView request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: application/x-www-form-urlencoded\n"
</del><ins>+PASS ArrayBufferView request sends no Content-Type without setRequestHeader() call
</ins><span class="cx"> PASS ArrayBufferView request keeps setRequestHeader() Content-Type and charset
</span><span class="cx"> PASS FormData request respects setRequestHeader("")
</span><span class="cx"> PASS FormData request has correct default Content-Type of "multipart/form-data; boundary=_"
</span><span class="cx"> PASS FormData request keeps setRequestHeader() Content-Type and charset
</span><span class="cx"> PASS URLSearchParams respects setRequestHeader("")
</span><del>-FAIL URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8" assert_equals: expected "Content-Type: application/x-www-form-urlencoded;charset=UTF-8\n" but got "Content-Type: text/plain;charset=UTF-8\n"
</del><ins>+PASS URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8"
</ins><span class="cx"> PASS URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
</span><del>-PASS ReadableStream request respects setRequestHeader("")
-FAIL ReadableStream request with under type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "Content-Type: text/plain;charset=UTF-8\n"
-FAIL ReadableStream request keeps setRequestHeader() Content-Type and charset assert_equals: expected "Content-Type: application/xml;charset=ASCII\n" but got "Content-Type: application/xml;charset=UTF-8\n"
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiosimportedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt    2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt       2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1,37 +0,0 @@
</span><del>-CONSOLE MESSAGE: ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.
-CONSOLE MESSAGE: ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.
-CONSOLE MESSAGE: ArrayBuffer is deprecated in XMLHttpRequest.send(). Use ArrayBufferView instead.
-
-PASS setRequestHeader("") sends a blank string
-PASS setRequestHeader(" ") sends the string " "
-PASS setRequestHeader(null) sends the string "null"
-PASS setRequestHeader(undefined) sends the string "undefined"
-PASS String request has correct default Content-Type of "text/plain;charset=UTF-8"
-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"
-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"
-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
-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
-PASS ArrayBuffer request respects setRequestHeader("")
-FAIL ArrayBuffer request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "content-type: application/x-www-form-urlencoded"
-PASS ArrayBuffer request keeps setRequestHeader() Content-Type and charset
-PASS ArrayBufferView request respects setRequestHeader("")
-FAIL ArrayBufferView request sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "content-type: application/x-www-form-urlencoded"
-PASS ArrayBufferView request keeps setRequestHeader() Content-Type and charset
-PASS FormData request respects setRequestHeader("")
-PASS FormData request has correct default Content-Type of "multipart/form-data;boundary=_"
-PASS FormData request keeps setRequestHeader() Content-Type and charset
-PASS URLSearchParams respects setRequestHeader("")
-FAIL URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8" assert_equals: expected "content-type: application/x-www-form-urlencoded;charset=utf-8" but got "content-type: text/plain;charset=utf-8"
-PASS URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
-PASS ReadableStream request respects setRequestHeader("")
-FAIL ReadableStream request with under type sends no Content-Type without setRequestHeader() call assert_equals: expected "" but got "content-type: text/plain;charset=utf-8"
-FAIL ReadableStream request keeps setRequestHeader() Content-Type and charset assert_equals: expected "content-type: application/xml;charset=ascii" but got "content-type: application/xml;charset=utf-8"
-
</del></span></pre></div>
<a id="trunkLayoutTestsplatformioswk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-wk2/TestExpectations      2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1217,9 +1217,6 @@
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/175939 [ Debug ] editing/execCommand/forward-delete-read-write-canvas.html [ Skip ]
</span><span class="cx"> 
</span><del>-# <rdar://problem/32826391>
-imported/w3c/web-platform-tests/xhr/setrequestheader-content-type.htm [ Failure ]
-
</del><span class="cx"> webkit.org/b/173608 webrtc/video-replace-muted-track.html [ Skip ]
</span><span class="cx"> 
</span><span class="cx"> webkit.org/b/187388 animations/needs-layout.html [ Pass ImageOnlyFailure ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations  2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/LayoutTests/platform/mac/TestExpectations     2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1316,9 +1316,6 @@
</span><span class="cx"> fast/dom/HTMLMeterElement/meter-appearances-capacity.html [ Failure ]
</span><span class="cx"> fast/dom/HTMLMeterElement/meter-appearances-rating-relevancy.html [ Failure ]
</span><span class="cx"> 
</span><del>-# <rdar://problem/32826391> LayoutTest imported/w3c/web-platform-tests/xhr/setrequestheader-content-type.htm is failing on High Sierra
-imported/w3c/web-platform-tests/xhr/setrequestheader-content-type.htm [ Failure ]
-
</del><span class="cx"> # <rdar://problem/32864306> Unskip after bots have CTFontCopyPhysicalFont()
</span><span class="cx"> fast/text/system-font-japanese-synthetic-italic.html [ Pass ImageOnlyFailure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1importedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxtfromrev279379trunkLayoutTestsplatformiosimportedw3cwebplatformtestsxhrsetrequestheadercontenttypeexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt (from rev 279379, trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt) (0 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/xhr/setrequestheader-content-type-expected.txt   2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+
+PASS setRequestHeader("") sends a blank string
+PASS setRequestHeader(" ") sends the string " "
+PASS setRequestHeader(null) sends the string "null"
+PASS setRequestHeader(undefined) sends the string "undefined"
+PASS String request has correct default Content-Type of "text/plain;charset=UTF-8"
+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"
+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"
+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: application/x-www-form-urlencoded\n"
+PASS Blob request with unset type keeps setRequestHeader() Content-Type and charset
+PASS Blob request with set type respects setRequestHeader("") to be specified
+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
+PASS ArrayBuffer request respects setRequestHeader("")
+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 keeps setRequestHeader() Content-Type and charset
+PASS ArrayBufferView request respects setRequestHeader("")
+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 keeps setRequestHeader() Content-Type and charset
+PASS FormData request respects setRequestHeader("")
+PASS FormData request has correct default Content-Type of "multipart/form-data; boundary=_"
+PASS FormData request keeps setRequestHeader() Content-Type and charset
+PASS URLSearchParams respects setRequestHeader("")
+PASS URLSearchParams request has correct default Content-Type of "application/x-www-form-urlencoded;charset=UTF-8"
+PASS URLSearchParams request keeps setRequestHeader() Content-Type, with charset adjusted to UTF-8
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/Source/WebCore/ChangeLog      2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2021-06-29  Alex Christensen  <achristensen@webkit.org>
+
+        xhr.send(URLSearchParams) should align default Content-Type header field with Chrome and Firefox
+        https://bugs.webkit.org/show_bug.cgi?id=227477
+
+        Reviewed by Chris Dumez.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::send):
+        * xml/XMLHttpRequest.h:
+        * xml/XMLHttpRequest.idl:
+
</ins><span class="cx"> 2021-06-29  Michael Catanzaro  <mcatanzaro@gnome.org>
</span><span class="cx"> 
</span><span class="cx">         Fix more -Wreturn-type warnings
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp      2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp 2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> #include "StringAdaptors.h"
</span><span class="cx"> #include "TextResourceDecoder.h"
</span><span class="cx"> #include "ThreadableLoader.h"
</span><ins>+#include "URLSearchParams.h"
</ins><span class="cx"> #include "XMLDocument.h"
</span><span class="cx"> #include "XMLHttpRequestProgressEvent.h"
</span><span class="cx"> #include "XMLHttpRequestUpload.h"
</span><span class="lines">@@ -453,6 +454,7 @@
</span><span class="cx">             [this] (const RefPtr<JSC::ArrayBufferView>& arrayBufferView) -> ExceptionOr<void> { return send(*arrayBufferView); },
</span><span class="cx">             [this] (const RefPtr<JSC::ArrayBuffer>& arrayBuffer) -> ExceptionOr<void> { return send(*arrayBuffer); },
</span><span class="cx">             [this] (const RefPtr<DOMFormData>& formData) -> ExceptionOr<void> { return send(*formData); },
</span><ins>+            [this] (const RefPtr<URLSearchParams>& searchParams) -> ExceptionOr<void> { return send(*searchParams); },
</ins><span class="cx">             [this] (const String& string) -> ExceptionOr<void> { return send(string); }
</span><span class="cx">         );
</span><span class="cx">     }
</span><span class="lines">@@ -536,6 +538,13 @@
</span><span class="cx">     return createRequest();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ExceptionOr<void> XMLHttpRequest::send(const URLSearchParams& params)
+{
+    if (!m_requestHeaders.contains(HTTPHeaderName::ContentType))
+        m_requestHeaders.set(HTTPHeaderName::ContentType, "application/x-www-form-urlencoded;charset=UTF-8"_s);
+    return send(params.toString());
+}
+
</ins><span class="cx"> ExceptionOr<void> XMLHttpRequest::send(DOMFormData& body)
</span><span class="cx"> {
</span><span class="cx">     if (auto result = prepareToSend())
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.h (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.h        2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.h   2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> class SharedBuffer;
</span><span class="cx"> class TextResourceDecoder;
</span><span class="cx"> class ThreadableLoader;
</span><ins>+class URLSearchParams;
</ins><span class="cx"> class XMLHttpRequestUpload;
</span><span class="cx"> struct OwnedString;
</span><span class="cx"> 
</span><span class="lines">@@ -70,7 +71,7 @@
</span><span class="cx">     EventTargetInterface eventTargetInterface() const override { return XMLHttpRequestEventTargetInterfaceType; }
</span><span class="cx">     ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); }
</span><span class="cx"> 
</span><del>-    using SendTypes = Variant<RefPtr<Document>, RefPtr<Blob>, RefPtr<JSC::ArrayBufferView>, RefPtr<JSC::ArrayBuffer>, RefPtr<DOMFormData>, String>;
</del><ins>+    using SendTypes = Variant<RefPtr<Document>, RefPtr<Blob>, RefPtr<JSC::ArrayBufferView>, RefPtr<JSC::ArrayBuffer>, RefPtr<DOMFormData>, String, RefPtr<URLSearchParams>>;
</ins><span class="cx"> 
</span><span class="cx">     const URL& url() const { return m_url; }
</span><span class="cx">     String statusText() const;
</span><span class="lines">@@ -166,6 +167,7 @@
</span><span class="cx">     void notifyIsDone(bool) final;
</span><span class="cx"> 
</span><span class="cx">     std::optional<ExceptionOr<void>> prepareToSend();
</span><ins>+    ExceptionOr<void> send(const URLSearchParams&);
</ins><span class="cx">     ExceptionOr<void> send(Document&);
</span><span class="cx">     ExceptionOr<void> send(const String& = { });
</span><span class="cx">     ExceptionOr<void> send(Blob&);
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (279379 => 279380)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.idl      2021-06-29 18:55:06 UTC (rev 279379)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl 2021-06-29 19:07:43 UTC (rev 279380)
</span><span class="lines">@@ -26,8 +26,8 @@
</span><span class="cx">  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-// FIXME: Add URLSearchParams and ReadableStream to the union when supported.
-typedef (Blob or BufferSource or DOMFormData or USVString) BodyInit;
</del><ins>+// FIXME: Add ReadableStream to the union when supported.
+typedef (Blob or BufferSource or DOMFormData or USVString or URLSearchParams) BodyInit;
</ins><span class="cx"> 
</span><span class="cx"> enum XMLHttpRequestResponseType {
</span><span class="cx">     "",
</span></span></pre>
</div>
</div>

</body>
</html>