<!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>[193924] 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/193924">193924</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2015-12-10 13:26:28 -0800 (Thu, 10 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/192796">r192796</a>) WKBundlePageResourceLoadClient should be able to setHTTPBody in willSendRequestForFrame
https://bugs.webkit.org/show_bug.cgi?id=152022
rdar://problem/23763584

Reviewed by Darin Adler.

Source/WebKit2:

* Shared/API/c/WKURLRequest.cpp:
(WKURLRequestCopyHTTPMethod):
(WKURLRequestCopyWithHTTPBody):
(WKURLRequestSetDefaultTimeoutInterval):
* Shared/API/c/WKURLRequest.h:
Make WKURLRequestCopyWithHTTPBody SPI for testing.
* Shared/API/c/mac/WKURLRequestNS.mm:
(WKURLRequestCreateWithNSURLRequest):
Crash if someone tries to use an NSURLRequest with HTTPBodyStream, which will not work with the network process.
* WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
(WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
Use an HTTP body if the client's willSendRequestForFrame returned one.
This is the functional change of this patch.

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::willSendRequestForFrame):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::setWillSendRequestReturnsNull):
(WTR::TestRunner::willSendRequestReturnsNullOnRedirect):
(WTR::TestRunner::setWillSendRequestReturnsNullOnRedirect):
(WTR::TestRunner::setWillSendRequestAddsHTTPBody):
(WTR::TestRunner::willSendRequestHTTPBody):
Added setWillSendRequestAddsHTTPBody that uses new SPI for testing.

LayoutTests:

* TestExpectations:
* http/tests/misc/resources/post-echo.cgi: Copied from LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi.
* http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt: Added.
* http/tests/misc/will-send-request-with-client-provided-http-body.html: Added.
* platform/wk2/TestExpectations:
New test for WK2 only.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKURLRequestcpp">trunk/Source/WebKit2/Shared/API/c/WKURLRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcWKURLRequesth">trunk/Source/WebKit2/Shared/API/c/WKURLRequest.h</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIcmacWKURLRequestNSmm">trunk/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageResourceLoadClientcpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsmiscresourcespostechocgi">trunk/LayoutTests/http/tests/misc/resources/post-echo.cgi</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscwillsendrequestwithclientprovidedhttpbodyexpectedtxt">trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmiscwillsendrequestwithclientprovidedhttpbodyhtml">trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/LayoutTests/ChangeLog        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-12-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        REGRESSION (r192796) WKBundlePageResourceLoadClient should be able to setHTTPBody in willSendRequestForFrame
+        https://bugs.webkit.org/show_bug.cgi?id=152022
+        rdar://problem/23763584
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations:
+        * http/tests/misc/resources/post-echo.cgi: Copied from LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi.
+        * http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt: Added.
+        * http/tests/misc/will-send-request-with-client-provided-http-body.html: Added.
+        * platform/wk2/TestExpectations:
+        New test for WK2 only.
+
</ins><span class="cx"> 2015-12-10  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change skin tone support for two emoji.
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/LayoutTests/TestExpectations        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -42,8 +42,9 @@
</span><span class="cx"> quicklook [ Skip ]
</span><span class="cx"> http/tests/quicklook [ Skip ]
</span><span class="cx"> 
</span><del>-# This test is WebKit2-only
</del><ins>+# These tests are WebKit2-only
</ins><span class="cx"> http/tests/appcache/decide-navigation-policy-after-delay.html [ Skip ]
</span><ins>+http/tests/misc/will-send-request-with-client-provided-http-body.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # Only Mac and iOS have an implementation of UIScriptController::doAsyncTask().
</span><span class="cx"> fast/harness/ui-side-scripts.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscresourcespostechocgifromrev193874trunkLayoutTestshttptestsxmlhttprequestresourcespostechocgi"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/http/tests/misc/resources/post-echo.cgi (from rev 193874, trunk/LayoutTests/http/tests/xmlhttprequest/resources/post-echo.cgi) (0 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/resources/post-echo.cgi                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/post-echo.cgi        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+#!/usr/bin/perl -w
+
+print &quot;Content-type: text/plain\n\n&quot;; 
+
+if ($ENV{'REQUEST_METHOD'} eq &quot;POST&quot;) {
+    read(STDIN, $request, $ENV{'CONTENT_LENGTH'}) || die &quot;Could not get query\n&quot;;
+    print $request;
+} else {
+    print &quot;Wrong method: &quot; . $ENV{'REQUEST_METHOD'} . &quot;\n&quot;;
+} 
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscwillsendrequestwithclientprovidedhttpbodyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt (0 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body-expected.txt        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+This tests that the http body set by willSendRequestForFrame is sent.
+
+Request body before setWillSendRequestAddsHTTPBody: This body should be sent
+Request body after setWillSendRequestAddsHTTPBody: This body should also be sent
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsmiscwillsendrequestwithclientprovidedhttpbodyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body.html (0 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/misc/will-send-request-with-client-provided-http-body.html        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;p&gt;This tests that the http body set by willSendRequestForFrame is sent.&lt;/p&gt;
+&lt;pre id=&quot;console&quot;&gt;&lt;/pre&gt;
+&lt;script&gt;
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function log(msg)
+    {
+        document.getElementById('console').appendChild(document.createTextNode(msg + &quot;\n&quot;));
+    }
+
+    var xhr1 = new XMLHttpRequest();
+    xhr1.onreadystatechange = function () {
+        if (xhr1.readyState == 4){
+            log(&quot;Request body before setWillSendRequestAddsHTTPBody: &quot; + xhr1.responseText);
+            testRunner.setWillSendRequestAddsHTTPBody(&quot;This body should also be sent&quot;);
+            
+            var xhr2 = new XMLHttpRequest();
+            xhr2.onreadystatechange = function () {
+                if (xhr2.readyState == 4){
+                    log(&quot;Request body after setWillSendRequestAddsHTTPBody: &quot; + xhr2.responseText);
+                    if (window.testRunner)
+                        testRunner.notifyDone();
+                }            
+            }
+            xhr2.open(&quot;POST&quot;, &quot;resources/post-echo.cgi&quot;);
+            xhr2.send(&quot;This body should not be sent because of setWillSendRequestHTTPBody&quot;);
+        }
+    };
+    xhr1.open(&quot;POST&quot;, &quot;resources/post-echo.cgi&quot;);
+    xhr1.send(&quot;This body should be sent&quot;);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -729,6 +729,9 @@
</span><span class="cx"> fast/images/animated-gif-no-layout.html [ Pass ]
</span><span class="cx"> fast/images/gif-loop-count.html [ Pass ]
</span><span class="cx"> 
</span><ins>+# DumpRenderTree does not implement setWillSendRequestHTTPBody
+http/tests/misc/will-send-request-with-client-provided-http-body.html [ Pass ]
+
</ins><span class="cx"> ### END OF (5) Progressions, expected successes that are expected failures in WebKit1.
</span><span class="cx"> ########################################
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Source/WebKit2/ChangeLog        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-12-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        REGRESSION (r192796) WKBundlePageResourceLoadClient should be able to setHTTPBody in willSendRequestForFrame
+        https://bugs.webkit.org/show_bug.cgi?id=152022
+        rdar://problem/23763584
+
+        Reviewed by Darin Adler.
+
+        * Shared/API/c/WKURLRequest.cpp:
+        (WKURLRequestCopyHTTPMethod):
+        (WKURLRequestCopyWithHTTPBody):
+        (WKURLRequestSetDefaultTimeoutInterval):
+        * Shared/API/c/WKURLRequest.h:
+        Make WKURLRequestCopyWithHTTPBody SPI for testing.
+        * Shared/API/c/mac/WKURLRequestNS.mm:
+        (WKURLRequestCreateWithNSURLRequest):
+        Crash if someone tries to use an NSURLRequest with HTTPBodyStream, which will not work with the network process.
+        * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp:
+        (WebKit::InjectedBundlePageResourceLoadClient::willSendRequestForFrame):
+        Use an HTTP body if the client's willSendRequestForFrame returned one.
+        This is the functional change of this patch.
+
</ins><span class="cx"> 2015-12-10  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CoordinatedGraphics] Reserve capacity for the children vector in CoordinatedGraphicsScene::setLayerChildrenIfNeeded()
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKURLRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKURLRequest.cpp (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKURLRequest.cpp        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Source/WebKit2/Shared/API/c/WKURLRequest.cpp        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;APIURLRequest.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><ins>+#include &quot;WKData.h&quot;
</ins><span class="cx"> #include &lt;WebCore/URL.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -58,6 +59,13 @@
</span><span class="cx">     return toCopiedAPI(toImpl(requestRef)-&gt;resourceRequest().httpMethod());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WKURLRequestRef WKURLRequestCopySettingHTTPBody(WKURLRequestRef requestRef, WKDataRef body)
+{
+    WebCore::ResourceRequest requestCopy(toImpl(requestRef)-&gt;resourceRequest());
+    requestCopy.setHTTPBody(FormData::create(WKDataGetBytes(body), WKDataGetSize(body)));
+    return toAPI(&amp;API::URLRequest::create(requestCopy).leakRef());
+}
+
</ins><span class="cx"> void WKURLRequestSetDefaultTimeoutInterval(double timeoutInterval)
</span><span class="cx"> {
</span><span class="cx">     API::URLRequest::setDefaultTimeoutInterval(timeoutInterval);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcWKURLRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/WKURLRequest.h (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/WKURLRequest.h        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Source/WebKit2/Shared/API/c/WKURLRequest.h        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -42,6 +42,8 @@
</span><span class="cx"> 
</span><span class="cx"> WK_EXPORT WKStringRef WKURLRequestCopyHTTPMethod(WKURLRequestRef);
</span><span class="cx"> 
</span><ins>+WK_EXPORT WKURLRequestRef WKURLRequestCopySettingHTTPBody(WKURLRequestRef, WKDataRef);
+
</ins><span class="cx"> WK_EXPORT void WKURLRequestSetDefaultTimeoutInterval(double);
</span><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIcmacWKURLRequestNSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Source/WebKit2/Shared/API/c/mac/WKURLRequestNS.mm        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> WKURLRequestRef WKURLRequestCreateWithNSURLRequest(NSURLRequest* urlRequest)
</span><span class="cx"> {
</span><ins>+    if ([urlRequest HTTPBodyStream])
+        return nullptr;
</ins><span class="cx">     RetainPtr&lt;NSURLRequest&gt; copiedURLRequest = adoptNS([urlRequest copy]);
</span><span class="cx">     return toAPI(&amp;API::URLRequest::create(copiedURLRequest.get()).leakRef());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleInjectedBundlePageResourceLoadClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -49,10 +49,15 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;API::URLRequest&gt; returnedRequest = adoptRef(toImpl(m_client.willSendRequestForFrame(toAPI(page), toAPI(frame), identifier, toAPI(request), toAPI(redirectResponse), m_client.base.clientInfo)));
</span><del>-    if (returnedRequest)
-        request.updateFromDelegatePreservingOldProperties(returnedRequest-&gt;resourceRequest());
-    else
-        request = ResourceRequest();
</del><ins>+    if (returnedRequest) {
+        // If the client returned an HTTP body, we want to use that http body. This is needed to fix &lt;rdar://problem/23763584&gt;
+        auto&amp; returnedResourceRequest = returnedRequest-&gt;resourceRequest();
+        RefPtr&lt;FormData&gt; returnedHTTPBody = returnedResourceRequest.httpBody();
+        request.updateFromDelegatePreservingOldProperties(returnedResourceRequest);
+        if (returnedHTTPBody)
+            request.setHTTPBody(WTF::move(returnedHTTPBody));
+    } else
+        request = { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundlePageResourceLoadClient::didReceiveResponseForResource(WebPage* page, WebFrame* frame, uint64_t identifier, const WebCore::ResourceResponse&amp; response)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Tools/ChangeLog        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-12-10  Alex Christensen  &lt;achristensen@webkit.org&gt;
+
+        REGRESSION (r192796) WKBundlePageResourceLoadClient should be able to setHTTPBody in willSendRequestForFrame
+        https://bugs.webkit.org/show_bug.cgi?id=152022
+        rdar://problem/23763584
+
+        Reviewed by Darin Adler.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::willSendRequestForFrame):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::setWillSendRequestReturnsNull):
+        (WTR::TestRunner::willSendRequestReturnsNullOnRedirect):
+        (WTR::TestRunner::setWillSendRequestReturnsNullOnRedirect):
+        (WTR::TestRunner::setWillSendRequestAddsHTTPBody):
+        (WTR::TestRunner::willSendRequestHTTPBody):
+        Added setWillSendRequestAddsHTTPBody that uses new SPI for testing.
+
</ins><span class="cx"> 2015-12-10  Aakash Jain  &lt;aakash_jain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove additional simulator checks before running layout-tests
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -135,6 +135,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setWillSendRequestReturnsNull(boolean flag);
</span><span class="cx">     void setWillSendRequestReturnsNullOnRedirect(boolean flag);
</span><ins>+    void setWillSendRequestAddsHTTPBody(DOMString body);
</ins><span class="cx">     
</span><span class="cx">     void setShouldStayOnPageAfterHandlingBeforeUnload(boolean flag);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -1166,6 +1166,14 @@
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx">     }
</span><ins>+    
+    if (injectedBundle.isTestRunning()) {
+        String body = injectedBundle.testRunner()-&gt;willSendRequestHTTPBody();
+        if (!body.isEmpty()) {
+            CString cBody = body.utf8();
+            return WKURLRequestCopySettingHTTPBody(request, WKDataCreate(reinterpret_cast&lt;const unsigned char*&gt;(cBody.data()), cBody.length()));
+        }
+    }
</ins><span class="cx"> 
</span><span class="cx">     WKRetain(request);
</span><span class="cx">     return request;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (193923 => 193924)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-12-10 20:44:55 UTC (rev 193923)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-12-10 21:26:28 UTC (rev 193924)
</span><span class="lines">@@ -27,11 +27,13 @@
</span><span class="cx"> #define TestRunner_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSWrappable.h&quot;
</span><ins>+#include &quot;StringFunctions.h&quot;
</ins><span class="cx"> #include &lt;JavaScriptCore/JSRetainPtr.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKBundleScriptWorld.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKRetainPtr.h&gt;
</span><span class="cx"> #include &lt;string&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><ins>+#include &lt;wtf/text/WTFString.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -210,6 +212,8 @@
</span><span class="cx">     void setWillSendRequestReturnsNull(bool f) { m_willSendRequestReturnsNull = f; }
</span><span class="cx">     bool willSendRequestReturnsNullOnRedirect() const { return m_willSendRequestReturnsNullOnRedirect; }
</span><span class="cx">     void setWillSendRequestReturnsNullOnRedirect(bool f) { m_willSendRequestReturnsNullOnRedirect = f; }
</span><ins>+    void setWillSendRequestAddsHTTPBody(JSStringRef body) { m_willSendRequestHTTPBody = toWTFString(toWK(body)); }
+    String willSendRequestHTTPBody() const { return m_willSendRequestHTTPBody; }
</ins><span class="cx"> 
</span><span class="cx">     void setTextDirection(JSStringRef);
</span><span class="cx"> 
</span><span class="lines">@@ -343,6 +347,7 @@
</span><span class="cx">     bool m_willSendRequestReturnsNull;
</span><span class="cx">     bool m_willSendRequestReturnsNullOnRedirect;
</span><span class="cx">     bool m_shouldStopProvisionalFrameLoads;
</span><ins>+    String m_willSendRequestHTTPBody;
</ins><span class="cx"> 
</span><span class="cx">     bool m_policyDelegateEnabled;
</span><span class="cx">     bool m_policyDelegatePermissive;
</span></span></pre>
</div>
</div>

</body>
</html>