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