WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
wk-tests-deprecated-soup.diff (text/plain), 10.35 KB, created by
Carlos Garcia Campos
on 2021-02-01 04:43:28 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2021-02-01 04:43:28 PST
Size:
10.35 KB
patch
obsolete
>diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index f22883818f7c..3a1eb8abc05f 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,13 @@ >+2021-02-01 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Migrate WebKitTestServer to libsoup 2.48 API >+ https://bugs.webkit.org/show_bug.cgi?id=219160 >+ <rdar://problem/71620310> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/Platform.h: Bump libsoup minimum required version to 2.54. >+ > 2021-01-31 Yusuke Suzuki <ysuzuki@apple.com> > > Date.parse returns non-integral time value >diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h >index b0d81772737d..0219ed938c89 100644 >--- a/Source/WTF/wtf/Platform.h >+++ b/Source/WTF/wtf/Platform.h >@@ -96,7 +96,7 @@ > #endif > > #if USE(SOUP) >-#define SOUP_VERSION_MIN_REQUIRED SOUP_VERSION_2_42 >+#define SOUP_VERSION_MIN_REQUIRED SOUP_VERSION_2_54 > #endif > > #if PLATFORM(COCOA) >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index c6843dfeda87..a2f4fcea82bd 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,23 @@ >+2021-02-01 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ [GTK][WPE] Migrate WebKitTestServer to libsoup 2.48 API >+ https://bugs.webkit.org/show_bug.cgi?id=219160 >+ <rdar://problem/71620310> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp: >+ (serverCallback): >+ * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp: >+ (serverCallback): >+ * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp: >+ (serverCallback): >+ * TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp: >+ (WebKitTestServer::WebKitTestServer): >+ (WebKitTestServer::run): >+ (WebKitTestServer::port const): >+ * TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h: >+ > 2021-01-29 Don Olmstead <don.olmstead@sony.com> > > [webkitpy] Thread.isAlive was renamed to Thread.is_alive >diff --git a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp >index df1cb121e1f7..c92063fb2f4f 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp >@@ -375,8 +375,9 @@ unsigned gProxyServerPort; > > static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext* context, void*) > { >+ unsigned port = g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS((soup_client_context_get_local_address(context)))); > if (message->method == SOUP_METHOD_CONNECT) { >- g_assert_cmpuint(soup_server_get_port(server), ==, gProxyServerPort); >+ g_assert_cmpuint(port, ==, gProxyServerPort); > auto tunnel = makeUnique<Tunnel>(server, message); > auto* tunnelPtr = tunnel.get(); > tunnelPtr->connect([tunnel = WTFMove(tunnel)](const char* errorMessage) { >@@ -399,7 +400,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* > if (g_str_has_suffix(path, "/auth-test.html") || g_str_has_suffix(path, "/empty-realm.html")) { > bool isProxy = g_str_has_prefix(path, "/proxy"); > if (isProxy) >- g_assert_cmpuint(soup_server_get_port(server), ==, gProxyServerPort); >+ g_assert_cmpuint(port, ==, gProxyServerPort); > > const char* authorization = soup_message_headers_get_one(message->request_headers, "Authorization"); > // Require authentication. >diff --git a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp >index 7989a3922a4e..4a9510100af8 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp >@@ -716,7 +716,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* > gchar* header_str = g_strdup_printf("%s=%s; Max-Age=60", kCookieName, kCookieValue); > > if (g_str_equal(path, "/index.html")) { >- char* indexHtml = g_strdup_printf(kIndexHtmlFormat, soup_server_get_port(server)); >+ char* indexHtml = g_strdup_printf(kIndexHtmlFormat, kServer->port()); > soup_message_headers_replace(message->response_headers, "Set-Cookie", header_str); > soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, indexHtml, strlen(indexHtml)); > } else if (g_str_equal(path, "/image.png")) >diff --git a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp >index 2f3a2b2f7345..8e91c43d7bb9 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp >+++ b/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp >@@ -386,7 +386,7 @@ static void testWebContextLanguages(WebViewTest* test, gconstpointer) > g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED); > } > >-static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) >+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext* context, gpointer) > { > if (message->method != SOUP_METHOD_GET) { > soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); >@@ -404,7 +404,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char* > soup_message_body_complete(message->response_body); > soup_message_set_status(message, SOUP_STATUS_OK); > } else if (g_str_equal(path, "/echoPort")) { >- char* port = g_strdup_printf("%u", soup_server_get_port(server)); >+ char* port = g_strdup_printf("%u", g_inet_socket_address_get_port(G_INET_SOCKET_ADDRESS((soup_client_context_get_local_address(context))))); > soup_message_body_append(message->response_body, SOUP_MEMORY_TAKE, port, strlen(port)); > soup_message_body_complete(message->response_body); > soup_message_set_status(message, SOUP_STATUS_OK); >diff --git a/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp b/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp >index d2e495cad2a3..7e1085c79fe2 100644 >--- a/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp >+++ b/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp >@@ -23,6 +23,7 @@ > #include "TestMain.h" > #include <wtf/Threading.h> > #include <wtf/glib/GUniquePtr.h> >+#include <wtf/threads/BinarySemaphore.h> > > WebKitTestServer::WebKitTestServer(ServerOptions options) > { >@@ -31,23 +32,14 @@ WebKitTestServer::WebKitTestServer(ServerOptions options) > m_queue = WorkQueue::create("WebKitTestServer"); > } > >- GUniquePtr<char> sslCertificateFile; >- GUniquePtr<char> sslKeyFile; >+ m_soupServer = adoptGRef(soup_server_new("server-header", "WebKitTestServer ", nullptr)); >+ > if (options & ServerHTTPS) { > CString resourcesDir = Test::getResourcesDir(); >- sslCertificateFile.reset(g_build_filename(resourcesDir.data(), "test-cert.pem", NULL)); >- sslKeyFile.reset(g_build_filename(resourcesDir.data(), "test-key.pem", NULL)); >+ GUniquePtr<char> sslCertificateFile(g_build_filename(resourcesDir.data(), "test-cert.pem", nullptr)); >+ GUniquePtr<char> sslKeyFile(g_build_filename(resourcesDir.data(), "test-key.pem", nullptr)); >+ g_assert_true(soup_server_set_ssl_cert_file(m_soupServer.get(), sslCertificateFile.get(), sslKeyFile.get(), nullptr)); > } >- >- GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT)); >- soup_address_resolve_sync(address.get(), 0); >- >- m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_INTERFACE, address.get(), >- SOUP_SERVER_ASYNC_CONTEXT, m_queue ? m_queue->runLoop().mainContext() : nullptr, >- SOUP_SERVER_SSL_CERT_FILE, sslCertificateFile.get(), >- SOUP_SERVER_SSL_KEY_FILE, sslKeyFile.get(), nullptr)); >- m_baseURI = options & ServerHTTPS ? soup_uri_new("https://127.0.0.1/") : soup_uri_new("http://127.0.0.1/"); >- soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer.get())); > } > > WebKitTestServer::~WebKitTestServer() >@@ -59,15 +51,26 @@ WebKitTestServer::~WebKitTestServer() > > void WebKitTestServer::run(SoupServerCallback serverCallback) > { >+ soup_server_add_handler(m_soupServer.get(), nullptr, serverCallback, nullptr, nullptr); >+ >+ unsigned options = SOUP_SERVER_LISTEN_IPV4_ONLY; >+ if (soup_server_is_https(m_soupServer.get())) >+ options |= SOUP_SERVER_LISTEN_HTTPS; >+ > if (m_queue) { >- m_queue->dispatch([this, serverCallback] { >- soup_server_run_async(m_soupServer.get()); >- soup_server_add_handler(m_soupServer.get(), nullptr, serverCallback, nullptr, nullptr); >+ BinarySemaphore semaphore; >+ m_queue->dispatch([&] { >+ g_assert_true(soup_server_listen_local(m_soupServer.get(), SOUP_ADDRESS_ANY_PORT, static_cast<SoupServerListenOptions>(options), nullptr)); >+ semaphore.signal(); > }); >- } else { >- soup_server_run_async(m_soupServer.get()); >- soup_server_add_handler(m_soupServer.get(), nullptr, serverCallback, nullptr, nullptr); >- } >+ semaphore.wait(); >+ } else >+ g_assert_true(soup_server_listen_local(m_soupServer.get(), SOUP_ADDRESS_ANY_PORT, static_cast<SoupServerListenOptions>(options), nullptr)); >+ >+ GSList* uris = soup_server_get_uris(m_soupServer.get()); >+ g_assert_nonnull(uris); >+ m_baseURI = soup_uri_copy(static_cast<SoupURI*>(uris->data)); >+ g_slist_free_full(uris, reinterpret_cast<GDestroyNotify>(soup_uri_free)); > } > > void WebKitTestServer::addWebSocketHandler(SoupServerWebsocketCallback callback, gpointer userData) >@@ -113,3 +116,8 @@ CString WebKitTestServer::getURIForPath(const char* path) const > soup_uri_free(uri); > return uriString.get(); > } >+ >+unsigned WebKitTestServer::port() const >+{ >+ return soup_uri_get_port(m_baseURI); >+} >diff --git a/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h b/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h >index 2814527f19b9..f5bd47d6d33c 100644 >--- a/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h >+++ b/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h >@@ -38,6 +38,7 @@ public: > virtual ~WebKitTestServer(); > > SoupURI* baseURI() const { return m_baseURI; } >+ unsigned port() const; > CString getURIForPath(const char* path) const; > void run(SoupServerCallback); >
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
Flags:
mcatanzaro
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 219160
:
414575
|
414576
|
414577
|
414660
| 418858