[SOUP] Move URLSoup back to WebCore after r238771
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 11:01:17 +0000 (11:01 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Dec 2018 11:01:17 +0000 (11:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192306

Reviewed by Michael Catanzaro.

Source/WebCore:

Add soupURIToURL() and urlToSoupURI() to replace the URL contructor taking a Soup URI and
URL::createSoupURI(). Fix several build failures that showed up after removing the soup includes from URL
header.

* platform/Cookie.h:
* platform/SharedBuffer.h:
* platform/SourcesSoup.txt:
* platform/network/soup/CookieSoup.cpp:
* platform/network/soup/GUniquePtrSoup.h: Renamed from Source/WTF/wtf/glib/GUniquePtrSoup.h.
* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::setCookiesFromDOM const):
(WebCore::NetworkStorageSession::deleteCookie const):
(WebCore::NetworkStorageSession::getCookies):
(WebCore::NetworkStorageSession::getRawCookies const):
(WebCore::cookiesForSession):
* platform/network/soup/ResourceErrorSoup.cpp:
(WebCore::failingURI):
* platform/network/soup/ResourceHandleSoup.cpp:
* platform/network/soup/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateSoupMessageMembers const):
(WebCore::ResourceRequest::updateFromSoupMessage):
(WebCore::ResourceRequest::createSoupURI const):
* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::updateFromSoupMessage):
* platform/network/soup/SocketStreamHandleImpl.h:
* platform/network/soup/SocketStreamHandleImplSoup.cpp:
(WebCore::SocketStreamHandleImpl::create):
* platform/network/soup/SoupNetworkSession.cpp:
* platform/network/soup/URLSoup.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp.
(WebCore::soupURIToURL):
(WebCore::urlToSoupURI):
* platform/network/soup/URLSoup.h: Renamed from Source/WTF/wtf/glib/URLSoup.cpp.

Source/WebKit:

Include GUniquePtrSoup from WebCore again and fix several build failures that showed up after removing the soup
includes from URL header.

* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate):
* PluginProcess/PluginProcess.cpp:
* Shared/API/glib/WebKitURIRequest.cpp:
* Shared/API/glib/WebKitURIResponse.cpp:
* UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
* UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkit_uri_scheme_request_finish_error): Use soupURIToURL().
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_load_uri): Use soupURIToURL().
* UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
* UIProcess/Launcher/glib/BubblewrapLauncher.h:
* UIProcess/Launcher/glib/FlatpakLauncher.cpp:
* UIProcess/Launcher/glib/FlatpakLauncher.h:

Source/WTF:

In r238771 URL was moved from WebCore to WTF, including the soup implementation. Unfortunately that added
libsoup as a new dependency of libjavascriptcoregtk.

* wtf/PlatformGTK.cmake:
* wtf/PlatformWPE.cmake:
* wtf/URL.h:
* wtf/glib/URLGLib.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp.

Tools:

Include GUniquePtrSoup from WebCore again.

* TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238851 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/PlatformGTK.cmake
Source/WTF/wtf/PlatformWPE.cmake
Source/WTF/wtf/URL.h
Source/WTF/wtf/glib/URLGLib.cpp [moved from Source/WTF/wtf/glib/URLSoup.cpp with 61% similarity]
Source/WebCore/ChangeLog
Source/WebCore/platform/Cookie.h
Source/WebCore/platform/SharedBuffer.h
Source/WebCore/platform/SourcesSoup.txt
Source/WebCore/platform/network/soup/CookieSoup.cpp
Source/WebCore/platform/network/soup/GUniquePtrSoup.h [moved from Source/WTF/wtf/glib/GUniquePtrSoup.h with 100% similarity]
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
Source/WebCore/platform/network/soup/ResourceRequest.h
Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp
Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp
Source/WebCore/platform/network/soup/SocketStreamHandleImpl.h
Source/WebCore/platform/network/soup/SocketStreamHandleImplSoup.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebCore/platform/network/soup/URLSoup.cpp [new file with mode: 0644]
Source/WebCore/platform/network/soup/URLSoup.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/soup/NetworkDataTaskSoup.cpp
Source/WebKit/PluginProcess/PluginProcess.cpp
Source/WebKit/Shared/API/glib/WebKitURIRequest.cpp
Source/WebKit/Shared/API/glib/WebKitURIResponse.cpp
Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp
Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.h
Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.cpp
Source/WebKit/UIProcess/Launcher/glib/FlatpakLauncher.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp

index 4cb8afa..2591746 100644 (file)
@@ -1,3 +1,18 @@
+2018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Move URLSoup back to WebCore after r238771
+        https://bugs.webkit.org/show_bug.cgi?id=192306
+
+        Reviewed by Michael Catanzaro.
+
+        In r238771 URL was moved from WebCore to WTF, including the soup implementation. Unfortunately that added
+        libsoup as a new dependency of libjavascriptcoregtk.
+
+        * wtf/PlatformGTK.cmake:
+        * wtf/PlatformWPE.cmake:
+        * wtf/URL.h:
+        * wtf/glib/URLGLib.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp.
+
 2018-12-03  Don Olmstead  <don.olmstead@sony.com>
 
         Fix some unused parameter warnings
index 006fc22..673f02d 100644 (file)
@@ -6,7 +6,6 @@ list(APPEND WTF_PUBLIC_HEADERS
     glib/GRefPtr.h
     glib/GTypedefs.h
     glib/GUniquePtr.h
-    glib/GUniquePtrSoup.h
     glib/RunLoopSourcePriority.h
     glib/WTFGType.h
 )
@@ -26,7 +25,7 @@ list(APPEND WTF_SOURCES
     glib/GLibUtilities.cpp
     glib/GRefPtr.cpp
     glib/RunLoopGLib.cpp
-    glib/URLSoup.cpp
+    glib/URLGLib.cpp
 
     text/unix/TextBreakIteratorInternalICUUnix.cpp
 
@@ -52,11 +51,9 @@ list(APPEND WTF_LIBRARIES
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${LIBSOUP_LIBRARIES}
     ${ZLIB_LIBRARIES}
 )
 
 list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${LIBSOUP_INCLUDE_DIRS}
 )
index a02da52..473cfd6 100644 (file)
@@ -4,7 +4,6 @@ list(APPEND WTF_PUBLIC_HEADERS
     glib/GRefPtr.h
     glib/GTypedefs.h
     glib/GUniquePtr.h
-    glib/GUniquePtrSoup.h
     glib/RunLoopSourcePriority.h
     glib/WTFGType.h
 
@@ -20,7 +19,7 @@ list(APPEND WTF_SOURCES
     glib/GLibUtilities.cpp
     glib/GRefPtr.cpp
     glib/RunLoopGLib.cpp
-    glib/URLSoup.cpp
+    glib/URLGLib.cpp
 
     linux/CurrentProcessMemoryStatus.cpp
     linux/MemoryFootprintLinux.cpp
@@ -37,11 +36,9 @@ list(APPEND WTF_LIBRARIES
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
-    ${LIBSOUP_LIBRARIES}
     ${ZLIB_LIBRARIES}
 )
 
 list(APPEND WTF_SYSTEM_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
-    ${LIBSOUP_INCLUDE_DIRS}
 )
index 9979e69..268867e 100644 (file)
 typedef const struct __CFURL* CFURLRef;
 #endif
 
-#if USE(SOUP)
-#include <wtf/glib/GUniquePtrSoup.h>
-#endif
-
 #if USE(FOUNDATION)
 OBJC_CLASS NSURL;
 #endif
@@ -179,11 +175,6 @@ public:
     RetainPtr<CFURLRef> createCFURL() const;
 #endif
 
-#if USE(SOUP)
-    URL(SoupURI*);
-    GUniquePtr<SoupURI> createSoupURI() const;
-#endif
-
 #if USE(FOUNDATION)
     URL(NSURL*);
     operator NSURL*() const;
similarity index 61%
rename from Source/WTF/wtf/glib/URLSoup.cpp
rename to Source/WTF/wtf/glib/URLGLib.cpp
index 55dbc7e..f8aaab8 100644 (file)
  */
 
 #include "config.h"
+#include "URL.h"
 
-#if USE(SOUP)
+#if USE(GLIB)
 
-#include <libsoup/soup.h>
-#include <wtf/URL.h>
-#include <wtf/URLParser.h>
+#include <glib.h>
 #include <wtf/text/CString.h>
 
 namespace WTF {
 
-URL::URL(SoupURI* soupURI)
-{
-    if (!soupURI) {
-        invalidate();
-        return;
-    }
-
-    GUniquePtr<gchar> urlString(soup_uri_to_string(soupURI, FALSE));
-    URLParser parser(String::fromUTF8(urlString.get()));
-    *this = parser.result();
-
-    if (!isValid())
-        return;
-
-    // Motivated by https://bugs.webkit.org/show_bug.cgi?id=38956. libsoup
-    // does not add the password to the URL when calling
-    // soup_uri_to_string, and thus the requests are not properly
-    // built. Fixing soup_uri_to_string is a no-no as the maintainer does
-    // not want to break compatibility with previous implementations
-    if (soupURI->password)
-        setPass(String::fromUTF8(soupURI->password));
-}
-
-GUniquePtr<SoupURI> URL::createSoupURI() const
-{
-    if (!isValid())
-        return nullptr;
-
-    return GUniquePtr<SoupURI>(soup_uri_new(string().utf8().data()));
-}
-
 bool URL::hostIsIPAddress(StringView host)
 {
     return !host.isEmpty() && g_hostname_is_ip_address(host.utf8().data());
@@ -72,4 +40,4 @@ bool URL::hostIsIPAddress(StringView host)
 
 } // namespace WTF
 
-#endif
+#endif // USE(GLIB)
index 833ddf6..d85b8da 100644 (file)
@@ -1,3 +1,45 @@
+2018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Move URLSoup back to WebCore after r238771
+        https://bugs.webkit.org/show_bug.cgi?id=192306
+
+        Reviewed by Michael Catanzaro.
+
+        Add soupURIToURL() and urlToSoupURI() to replace the URL contructor taking a Soup URI and
+        URL::createSoupURI(). Fix several build failures that showed up after removing the soup includes from URL
+        header.
+
+        * platform/Cookie.h:
+        * platform/SharedBuffer.h:
+        * platform/SourcesSoup.txt:
+        * platform/network/soup/CookieSoup.cpp:
+        * platform/network/soup/GUniquePtrSoup.h: Renamed from Source/WTF/wtf/glib/GUniquePtrSoup.h.
+        * platform/network/soup/NetworkStorageSessionSoup.cpp:
+        (WebCore::NetworkStorageSession::setCookiesFromDOM const):
+        (WebCore::NetworkStorageSession::deleteCookie const):
+        (WebCore::NetworkStorageSession::getCookies):
+        (WebCore::NetworkStorageSession::getRawCookies const):
+        (WebCore::cookiesForSession):
+        * platform/network/soup/ResourceErrorSoup.cpp:
+        (WebCore::failingURI):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        * platform/network/soup/ResourceRequest.h:
+        (WebCore::ResourceRequest::ResourceRequest):
+        * platform/network/soup/ResourceRequestSoup.cpp:
+        (WebCore::ResourceRequest::updateSoupMessageMembers const):
+        (WebCore::ResourceRequest::updateFromSoupMessage):
+        (WebCore::ResourceRequest::createSoupURI const):
+        * platform/network/soup/ResourceResponseSoup.cpp:
+        (WebCore::ResourceResponse::updateFromSoupMessage):
+        * platform/network/soup/SocketStreamHandleImpl.h:
+        * platform/network/soup/SocketStreamHandleImplSoup.cpp:
+        (WebCore::SocketStreamHandleImpl::create):
+        * platform/network/soup/SoupNetworkSession.cpp:
+        * platform/network/soup/URLSoup.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp.
+        (WebCore::soupURIToURL):
+        (WebCore::urlToSoupURI):
+        * platform/network/soup/URLSoup.h: Renamed from Source/WTF/wtf/glib/URLSoup.cpp.
+
 2018-12-04  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Audit: tests should support async operations
index 16ca963..b1517db 100644 (file)
 #include <objc/objc.h>
 #endif
 
+#if USE(SOUP)
+typedef struct _SoupCookie SoupCookie;
+#endif
+
 namespace WebCore {
 
 struct Cookie {
index f868c2c..e2aae2f 100644 (file)
@@ -40,7 +40,7 @@
 #endif
 
 #if USE(SOUP)
-#include <wtf/glib/GUniquePtrSoup.h>
+#include "GUniquePtrSoup.h"
 #endif
 
 #if USE(GLIB)
index dbac313..f225a38 100644 (file)
@@ -37,6 +37,7 @@ platform/network/soup/ResourceResponseSoup.cpp
 platform/network/soup/SocketStreamHandleImplSoup.cpp
 platform/network/soup/SoupNetworkSession.cpp
 platform/network/soup/SynchronousLoaderClientSoup.cpp
+platform/network/soup/URLSoup.cpp
 platform/network/soup/WebKitSoupRequestGeneric.cpp
 
 platform/soup/PublicSuffixSoup.cpp
index eec169b..e44c4ae 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "Cookie.h"
 
+#include <libsoup/soup.h>
 #include <wtf/DateMath.h>
 
 namespace WebCore {
index 03d156e..7e213e8 100644 (file)
 
 #include "Cookie.h"
 #include "CookieRequestHeaderFieldProxy.h"
+#include "GUniquePtrSoup.h"
 #include "ResourceHandle.h"
 #include "SoupNetworkSession.h"
+#include "URLSoup.h"
 #include <libsoup/soup.h>
 #include <wtf/DateMath.h>
 #include <wtf/MainThread.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/glib/GUniquePtr.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 
 #if USE(LIBSECRET)
 #include "GRefPtrGtk.h"
@@ -318,11 +319,11 @@ void NetworkStorageSession::setCookiesFromDOM(const URL& firstParty, const SameS
 {
     UNUSED_PARAM(frameID);
     UNUSED_PARAM(pageID);
-    GUniquePtr<SoupURI> origin = url.createSoupURI();
+    GUniquePtr<SoupURI> origin = urlToSoupURI(url);
     if (!origin)
         return;
 
-    GUniquePtr<SoupURI> firstPartyURI = firstParty.createSoupURI();
+    GUniquePtr<SoupURI> firstPartyURI = urlToSoupURI(firstParty);
     if (!firstPartyURI)
         return;
 
@@ -369,7 +370,7 @@ void NetworkStorageSession::deleteCookie(const Cookie& cookie)
 
 void NetworkStorageSession::deleteCookie(const URL& url, const String& name) const
 {
-    GUniquePtr<SoupURI> uri = url.createSoupURI();
+    GUniquePtr<SoupURI> uri = urlToSoupURI(url);
     if (!uri)
         return;
 
@@ -447,7 +448,7 @@ Vector<Cookie> NetworkStorageSession::getAllCookies()
 Vector<Cookie> NetworkStorageSession::getCookies(const URL& url)
 {
     Vector<Cookie> cookies;
-    GUniquePtr<SoupURI> uri = url.createSoupURI();
+    GUniquePtr<SoupURI> uri = urlToSoupURI(url);
     if (!uri)
         return cookies;
 
@@ -466,7 +467,7 @@ bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteI
     UNUSED_PARAM(frameID);
     UNUSED_PARAM(pageID);
     rawCookies.clear();
-    GUniquePtr<SoupURI> uri = url.createSoupURI();
+    GUniquePtr<SoupURI> uri = urlToSoupURI(url);
     if (!uri)
         return false;
 
@@ -495,7 +496,7 @@ bool NetworkStorageSession::getRawCookies(const URL& firstParty, const SameSiteI
 
 static std::pair<String, bool> cookiesForSession(const NetworkStorageSession& session, const URL& url, bool forHTTPHeader, IncludeSecureCookies includeSecureCookies)
 {
-    GUniquePtr<SoupURI> uri = url.createSoupURI();
+    GUniquePtr<SoupURI> uri = urlToSoupURI(url);
     if (!uri)
         return { { }, false };
 
index f2e3b28..eeec328 100644 (file)
@@ -29,6 +29,7 @@
 #if USE(SOUP)
 
 #include "LocalizedStrings.h"
+#include "URLSoup.h"
 #include <libsoup/soup.h>
 #include <wtf/glib/GUniquePtr.h>
 #include <wtf/text/CString.h>
@@ -38,7 +39,7 @@ namespace WebCore {
 static URL failingURI(SoupURI* soupURI)
 {
     ASSERT(soupURI);
-    return URL(soupURI);
+    return soupURIToURL(soupURI);
 }
 
 static URL failingURI(SoupRequest* request)
index fb71813..63734c6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "CredentialStorage.h"
 #include "FileSystem.h"
+#include "GUniquePtrSoup.h"
 #include "HTTPParsers.h"
 #include "LocalizedStrings.h"
 #include "MIMETypeRegistry.h"
@@ -57,7 +58,6 @@
 #endif
 #include <wtf/CompletionHandler.h>
 #include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/glib/RunLoopSourcePriority.h>
 #include <wtf/text/CString.h>
 
index 7472ad2..9661bc4 100644 (file)
@@ -28,8 +28,7 @@
 #define ResourceRequest_h
 
 #include "ResourceRequestBase.h"
-#include <libsoup/soup.h>
-#include <wtf/glib/GUniquePtrSoup.h>
+#include "URLSoup.h"
 
 namespace WebCore {
 
@@ -78,7 +77,7 @@ namespace WebCore {
         }
 
         ResourceRequest(SoupRequest* soupRequest)
-            : ResourceRequestBase(URL(soup_request_get_uri(soupRequest)), ResourceRequestCachePolicy::UseProtocolCachePolicy)
+            : ResourceRequestBase(soupURIToURL(soup_request_get_uri(soupRequest)), ResourceRequestCachePolicy::UseProtocolCachePolicy)
             , m_acceptEncoding(true)
             , m_soupFlags(static_cast<SoupMessageFlags>(0))
             , m_initiatingPageID(0)
index ec4903e..aa95737 100644 (file)
 
 #include "BlobData.h"
 #include "BlobRegistryImpl.h"
+#include "GUniquePtrSoup.h"
 #include "HTTPParsers.h"
 #include "MIMETypeRegistry.h"
 #include "SharedBuffer.h"
+#include "URLSoup.h"
 #include "WebKitSoupRequestGeneric.h"
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -106,7 +107,7 @@ void ResourceRequest::updateSoupMessageMembers(SoupMessage* soupMessage) const
 {
     updateSoupMessageHeaders(soupMessage->request_headers);
 
-    GUniquePtr<SoupURI> firstParty = firstPartyForCookies().createSoupURI();
+    GUniquePtr<SoupURI> firstParty = urlToSoupURI(firstPartyForCookies());
     if (firstParty)
         soup_message_set_first_party(soupMessage, firstParty.get());
 
@@ -153,7 +154,7 @@ void ResourceRequest::updateSoupMessage(SoupMessage* soupMessage) const
 void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)
 {
     bool shouldPortBeResetToZero = m_url.port() && !m_url.port().value();
-    m_url = URL(soup_message_get_uri(soupMessage));
+    m_url = soupURIToURL(soup_message_get_uri(soupMessage));
 
     // SoupURI cannot differeniate between an explicitly specified port 0 and
     // no port specified.
@@ -168,7 +169,7 @@ void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)
         m_httpBody = FormData::create(soupMessage->request_body->data, soupMessage->request_body->length);
 
     if (SoupURI* firstParty = soup_message_get_first_party(soupMessage))
-        m_firstPartyForCookies = URL(firstParty);
+        m_firstPartyForCookies = soupURIToURL(firstParty);
 
     m_soupFlags = soup_message_get_flags(soupMessage);
 
@@ -216,7 +217,7 @@ GUniquePtr<SoupURI> ResourceRequest::createSoupURI() const
         return GUniquePtr<SoupURI>(soup_uri_new(urlString.utf8().data()));
     }
 
-    GUniquePtr<SoupURI> soupURI = m_url.createSoupURI();
+    GUniquePtr<SoupURI> soupURI = urlToSoupURI(m_url);
 
     // Versions of libsoup prior to 2.42 have a soup_uri_new that will convert empty passwords that are not
     // prefixed by a colon into null. Some parts of soup like the SoupAuthenticationManager will only be active
index e3a1c3e..03b350d 100644 (file)
@@ -27,6 +27,7 @@
 #include "HTTPHeaderNames.h"
 #include "HTTPParsers.h"
 #include "MIMETypeRegistry.h"
+#include "URLSoup.h"
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
@@ -40,7 +41,7 @@ void ResourceResponse::updateSoupMessageHeaders(SoupMessageHeaders* soupHeaders)
 
 void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage)
 {
-    m_url = URL(soup_message_get_uri(soupMessage));
+    m_url = soupURIToURL(soup_message_get_uri(soupMessage));
 
     switch (soup_message_get_http_version(soupMessage)) {
     case SOUP_HTTP_1_0:
index 6b8316f..6c4ddbb 100644 (file)
@@ -41,6 +41,9 @@
 #include <wtf/UniqueArray.h>
 #include <wtf/glib/GRefPtr.h>
 
+typedef struct _GIOStream GIOStream;
+typedef struct _GObject GObject;
+
 namespace WebCore {
 
 class SocketStreamError;
index 5af9473..b5ebde6 100644 (file)
@@ -41,6 +41,7 @@
 #include "SocketStreamError.h"
 #include "SocketStreamHandleClient.h"
 #include "SoupNetworkSession.h"
+#include "URLSoup.h"
 #include <gio/gio.h>
 #include <glib.h>
 #include <wtf/URL.h>
@@ -89,7 +90,7 @@ Ref<SocketStreamHandleImpl> SocketStreamHandleImpl::create(const URL& url, Socke
     if (!networkStorageSession)
         return socket;
 
-    auto uri = url.createSoupURI();
+    auto uri = urlToSoupURI(url);
     Ref<SocketStreamHandle> protectedSocketStreamHandle = socket.copyRef();
     soup_session_connect_async(networkStorageSession->getOrCreateSoupNetworkSession().soupSession(), uri.get(), socket->m_cancellable.get(),
         url.protocolIs("wss") ? reinterpret_cast<SoupSessionConnectProgressCallback>(connectProgressCallback) : nullptr,
index 7f76b59..f24e265 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "AuthenticationChallenge.h"
 #include "FileSystem.h"
+#include "GUniquePtrSoup.h"
 #include "Logging.h"
 #include "SoupNetworkProxySettings.h"
 #include <glib/gstdio.h>
@@ -38,7 +39,6 @@
 #include <pal/crypto/CryptoDigest.h>
 #include <wtf/HashSet.h>
 #include <wtf/NeverDestroyed.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/text/Base64.h>
 #include <wtf/text/CString.h>
 
diff --git a/Source/WebCore/platform/network/soup/URLSoup.cpp b/Source/WebCore/platform/network/soup/URLSoup.cpp
new file mode 100644 (file)
index 0000000..f51c4fd
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2014, 2018 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "URLSoup.h"
+
+#include <wtf/URL.h>
+
+namespace WebCore {
+
+URL soupURIToURL(SoupURI* soupURI)
+{
+    if (!soupURI)
+        return URL();
+
+    GUniquePtr<gchar> urlString(soup_uri_to_string(soupURI, FALSE));
+    URL url(URL(), String::fromUTF8(urlString.get()));
+    if (url.isValid()) {
+        // Motivated by https://bugs.webkit.org/show_bug.cgi?id=38956. libsoup
+        // does not add the password to the URL when calling
+        // soup_uri_to_string, and thus the requests are not properly
+        // built. Fixing soup_uri_to_string is a no-no as the maintainer does
+        // not want to break compatibility with previous implementations
+        if (soupURI->password)
+            url.setPass(String::fromUTF8(soupURI->password));
+    }
+
+    return url;
+}
+
+GUniquePtr<SoupURI> urlToSoupURI(const URL& url)
+{
+    if (!url.isValid())
+        return nullptr;
+
+    return GUniquePtr<SoupURI>(soup_uri_new(url.string().utf8().data()));
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/network/soup/URLSoup.h b/Source/WebCore/platform/network/soup/URLSoup.h
new file mode 100644 (file)
index 0000000..5e3a89b
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GUniquePtrSoup.h"
+
+namespace WTF {
+class URL;
+}
+
+namespace WebCore {
+URL soupURIToURL(SoupURI*);
+GUniquePtr<SoupURI> urlToSoupURI(const WTF::URL&);
+} // namespace WebCore
index 6bc5f4b..31ee076 100644 (file)
@@ -1,3 +1,28 @@
+2018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Move URLSoup back to WebCore after r238771
+        https://bugs.webkit.org/show_bug.cgi?id=192306
+
+        Reviewed by Michael Catanzaro.
+
+        Include GUniquePtrSoup from WebCore again and fix several build failures that showed up after removing the soup
+        includes from URL header.
+
+        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+        (WebKit::NetworkDataTaskSoup::tlsConnectionAcceptCertificate):
+        * PluginProcess/PluginProcess.cpp:
+        * Shared/API/glib/WebKitURIRequest.cpp:
+        * Shared/API/glib/WebKitURIResponse.cpp:
+        * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp:
+        * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
+        (webkit_uri_scheme_request_finish_error): Use soupURIToURL().
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkit_web_view_load_uri): Use soupURIToURL().
+        * UIProcess/API/gtk/WebKitAuthenticationDialog.cpp:
+        * UIProcess/Launcher/glib/BubblewrapLauncher.h:
+        * UIProcess/Launcher/glib/FlatpakLauncher.cpp:
+        * UIProcess/Launcher/glib/FlatpakLauncher.h:
+
 2018-12-04  Tim Horton  <timothy_horton@apple.com>
 
         Fix the watchOS build; stop unnecessarily linking CorePDF
index d6d9ae2..0b7b635 100644 (file)
@@ -423,7 +423,7 @@ gboolean NetworkDataTaskSoup::tlsConnectionAcceptCertificateCallback(GTlsConnect
 bool NetworkDataTaskSoup::tlsConnectionAcceptCertificate(GTlsCertificate* certificate, GTlsCertificateFlags tlsErrors)
 {
     ASSERT(m_soupRequest);
-    URL url(soup_request_get_uri(m_soupRequest.get()));
+    URL url = soupURIToURL(soup_request_get_uri(m_soupRequest.get()));
     auto error = SoupNetworkSession::checkTLSErrors(url, certificate, tlsErrors);
     if (!error)
         return true;
index 0823109..9c4e7a1 100644 (file)
@@ -39,6 +39,7 @@
 #include "WebProcessConnection.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/NotImplemented.h>
+#include <unistd.h>
 #include <wtf/MemoryPressureHandler.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/ProcessPrivilege.h>
index 31f61ce..9fe5957 100644 (file)
@@ -21,8 +21,8 @@
 #include "WebKitURIRequest.h"
 
 #include "WebKitURIRequestPrivate.h"
+#include <WebCore/GUniquePtrSoup.h>
 #include <glib/gi18n-lib.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/glib/WTFGType.h>
 #include <wtf/text/CString.h>
 
index 287eefd..d245589 100644 (file)
@@ -21,8 +21,8 @@
 #include "WebKitURIResponse.h"
 
 #include "WebKitURIResponsePrivate.h"
+#include <WebCore/GUniquePtrSoup.h>
 #include <glib/gi18n-lib.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/glib/WTFGType.h>
 #include <wtf/text/CString.h>
 
index 3196847..7ff7062 100644 (file)
@@ -27,6 +27,7 @@
 #include "APIWebsiteDataStore.h"
 
 #include <WebCore/FileSystem.h>
+#include <wtf/glib/GUniquePtr.h>
 
 #if PLATFORM(GTK)
 #define BASE_DIRECTORY "webkitgtk"
index 07b58ad..793cdbf 100644 (file)
 #include "WebKitWebContextPrivate.h"
 #include "WebKitWebView.h"
 #include "WebPageProxy.h"
+#include <WebCore/GUniquePtrSoup.h>
 #include <WebCore/ResourceError.h>
+#include <WebCore/URLSoup.h>
 #include <libsoup/soup.h>
 #include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/glib/RunLoopSourcePriority.h>
 #include <wtf/glib/WTFGType.h>
 #include <wtf/text/CString.h>
@@ -257,7 +258,7 @@ void webkit_uri_scheme_request_finish_error(WebKitURISchemeRequest* request, GEr
         return;
 
     priv->stream = nullptr;
-    ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), URL(priv->soupURI.get()), String::fromUTF8(error->message));
+    ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), soupURIToURL(priv->soupURI.get()), String::fromUTF8(error->message));
     priv->manager->didFailWithError(priv->requestID, resourceError);
     webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
 }
index 1bae074..f6bffad 100644 (file)
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <jsc/JSCContextPrivate.h>
 #include <WebCore/CertificateInfo.h>
+#include <WebCore/GUniquePtrSoup.h>
 #include <WebCore/JSDOMExceptionHandling.h>
 #include <WebCore/RefPtrCairo.h>
+#include <WebCore/URLSoup.h>
 #include <glib/gi18n-lib.h>
 #include <wtf/URL.h>
 #include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 #include <wtf/glib/WTFGType.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
@@ -2585,7 +2586,7 @@ void webkit_web_view_load_uri(WebKitWebView* webView, const gchar* uri)
     g_return_if_fail(uri);
 
     GUniquePtr<SoupURI> soupURI(soup_uri_new(uri));
-    getPage(webView).loadRequest(URL(soupURI.get()));
+    getPage(webView).loadRequest(soupURIToURL(soupURI.get()));
 }
 
 /**
index cae09a1..c734d8f 100644 (file)
@@ -25,6 +25,8 @@
 #include "WebKitCredentialPrivate.h"
 #include "WebKitWebView.h"
 #include <glib/gi18n-lib.h>
+#include <wtf/glib/GRefPtr.h>
+#include <wtf/glib/GUniquePtr.h>
 #include <wtf/glib/WTFGType.h>
 #include <wtf/text/CString.h>
 
index 550c520..0c2cd55 100644 (file)
 
 #include "ProcessLauncher.h"
 
-#include <glib.h>
+#include <wtf/glib/GRefPtr.h>
+
+typedef struct _GSubprocess GSubprocess;
+typedef struct _GSubprocessLauncher GSubprocessLauncher;
 
 namespace WebKit {
 
index bcb139f..c21b0ed 100644 (file)
@@ -28,6 +28,8 @@
 
 #if OS(LINUX)
 
+#include <gio/gio.h>
+
 namespace WebKit {
 
 GRefPtr<GSubprocess> flatpakSpawn(GSubprocessLauncher* launcher, const WebKit::ProcessLauncher::LaunchOptions& launchOptions, char** argv, GError **error)
index 75cba9f..c8442c1 100644 (file)
 
 #include "ProcessLauncher.h"
 
-#include <glib.h>
+#include <wtf/glib/GRefPtr.h>
+
+typedef struct _GSubprocess GSubprocess;
+typedef struct _GSubprocessLauncher GSubprocessLauncher;
 
 namespace WebKit {
 
index 54da335..94870bd 100644 (file)
@@ -1,3 +1,14 @@
+2018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [SOUP] Move URLSoup back to WebCore after r238771
+        https://bugs.webkit.org/show_bug.cgi?id=192306
+
+        Reviewed by Michael Catanzaro.
+
+        Include GUniquePtrSoup from WebCore again.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestCookieManager.cpp:
+
 2018-12-03  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Bump freetype, fontconfig, harfbuzz, cairo and icu in jhbuild
index 1baae95..b051452 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "WebKitTestServer.h"
 #include "WebViewTest.h"
+#include <WebCore/GUniquePtrSoup.h>
 #include <glib/gstdio.h>
-#include <wtf/glib/GUniquePtrSoup.h>
 
 static WebKitTestServer* kServer;