Title: [250597] trunk
Revision
250597
Author
[email protected]
Date
2019-10-02 01:00:33 -0700 (Wed, 02 Oct 2019)

Log Message

[GTK][WPE] Stop using legacy custom protocol implementation
https://bugs.webkit.org/show_bug.cgi?id=202407

Reviewed by Žan Doberšek.

.:

Make LEGACY_CUSTOM_PROTOCOL_MANAGER disabled by default.

* Source/cmake/OptionsFTW.cmake:
* Source/cmake/OptionsPlayStation.cmake:
* Source/cmake/OptionsWin.cmake:
* Source/cmake/WebKitFeatures.cmake:

Source/WebCore:

Remove the code to setup custom protocols in soup session.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::SoupNetworkSession):
* platform/network/soup/SoupNetworkSession.h:

Source/WebKit:

Use the new approach, which is simpler and doesn't require to go to the network process to load custom
protocols.

* NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp: Removed.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::m_messagePortChannelRegistry):
* NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Removed.
* NetworkProcess/soup/WebKitSoupRequestInputStream.h: Removed.
* PlatformGTK.cmake:
* PlatformWPE.cmake:
* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp: Removed.
* UIProcess/API/glib/WebKitCustomProtocolManagerClient.h: Removed.
* UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkitURISchemeRequestCreate):
(webkit_uri_scheme_request_get_scheme):
(webkit_uri_scheme_request_get_uri):
(webkit_uri_scheme_request_get_path):
(webkit_uri_scheme_request_get_web_view):
(webkitURISchemeRequestReadCallback):
(webkit_uri_scheme_request_finish_error):
* UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkitWebContextConstructed):
(webkitWebContextDispose):
(webkit_web_context_register_uri_scheme):
(webkitWebContextCreatePageForWebView):
* UIProcess/API/glib/WebKitWebContextPrivate.h:
* UIProcess/WebURLSchemeTask.h:
(WebKit::WebURLSchemeTask::request const):
* UIProcess/soup/WebProcessPoolSoup.cpp:

Tools:

Remove the tests to check failure after committed, because it's not possible to test it with current code.

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextURIScheme):

Modified Paths

Removed Paths

Diff

Modified: trunk/ChangeLog (250596 => 250597)


--- trunk/ChangeLog	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/ChangeLog	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,3 +1,17 @@
+2019-10-02  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Stop using legacy custom protocol implementation
+        https://bugs.webkit.org/show_bug.cgi?id=202407
+
+        Reviewed by Žan Doberšek.
+
+        Make LEGACY_CUSTOM_PROTOCOL_MANAGER disabled by default.
+
+        * Source/cmake/OptionsFTW.cmake:
+        * Source/cmake/OptionsPlayStation.cmake:
+        * Source/cmake/OptionsWin.cmake:
+        * Source/cmake/WebKitFeatures.cmake:
+
 2019-10-02  Zan Dobersek  <[email protected]>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports

Modified: trunk/Source/WebCore/ChangeLog (250596 => 250597)


--- trunk/Source/WebCore/ChangeLog	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebCore/ChangeLog	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,3 +1,16 @@
+2019-10-02  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Stop using legacy custom protocol implementation
+        https://bugs.webkit.org/show_bug.cgi?id=202407
+
+        Reviewed by Žan Doberšek.
+
+        Remove the code to setup custom protocols in soup session.
+
+        * platform/network/soup/SoupNetworkSession.cpp:
+        (WebCore::SoupNetworkSession::SoupNetworkSession):
+        * platform/network/soup/SoupNetworkSession.h:
+
 2019-10-02  Zan Dobersek  <[email protected]>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports

Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (250596 => 250597)


--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -45,7 +45,6 @@
 namespace WebCore {
 
 static bool gIgnoreTLSErrors;
-static GType gCustomProtocolRequestType;
 
 static CString& initialAcceptLanguages()
 {
@@ -134,8 +133,6 @@
 #endif
         nullptr);
 
-    setupCustomProtocols();
-
     if (!initialAcceptLanguages().isNull())
         setAcceptLanguages(initialAcceptLanguages());
 
@@ -337,24 +334,6 @@
     g_object_set(m_soupSession.get(), "accept-language", languages.data(), nullptr);
 }
 
-void SoupNetworkSession::setCustomProtocolRequestType(GType requestType)
-{
-    ASSERT(g_type_is_a(requestType, SOUP_TYPE_REQUEST));
-    gCustomProtocolRequestType = requestType;
-}
-
-void SoupNetworkSession::setupCustomProtocols()
-{
-    if (!g_type_is_a(gCustomProtocolRequestType, SOUP_TYPE_REQUEST))
-        return;
-
-    auto* requestClass = static_cast<SoupRequestClass*>(g_type_class_peek(gCustomProtocolRequestType));
-    if (!requestClass || !requestClass->schemes)
-        return;
-
-    soup_session_add_feature_by_type(m_soupSession.get(), gCustomProtocolRequestType);
-}
-
 void SoupNetworkSession::setShouldIgnoreTLSErrors(bool ignoreTLSErrors)
 {
     gIgnoreTLSErrors = ignoreTLSErrors;

Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h (250596 => 250597)


--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -72,9 +72,6 @@
     static Optional<ResourceError> checkTLSErrors(const URL&, GTlsCertificate*, GTlsCertificateFlags);
     static void allowSpecificHTTPSCertificateForHost(const CertificateInfo&, const String& host);
 
-    static void setCustomProtocolRequestType(GType);
-    void setupCustomProtocols();
-
     void getHostNamesWithHSTSCache(HashSet<String>&);
     void deleteHSTSCacheForHostNames(const Vector<String>&);
     void clearHSTSCache(WallTime);

Modified: trunk/Source/WebKit/ChangeLog (250596 => 250597)


--- trunk/Source/WebKit/ChangeLog	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/ChangeLog	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,3 +1,43 @@
+2019-10-02  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Stop using legacy custom protocol implementation
+        https://bugs.webkit.org/show_bug.cgi?id=202407
+
+        Reviewed by Žan Doberšek.
+
+        Use the new approach, which is simpler and doesn't require to go to the network process to load custom
+        protocols.
+
+        * NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp: Removed.
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::m_messagePortChannelRegistry):
+        * NetworkProcess/soup/WebKitSoupRequestInputStream.cpp: Removed.
+        * NetworkProcess/soup/WebKitSoupRequestInputStream.h: Removed.
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp: Removed.
+        * UIProcess/API/glib/WebKitCustomProtocolManagerClient.h: Removed.
+        * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
+        (webkitURISchemeRequestCreate):
+        (webkit_uri_scheme_request_get_scheme):
+        (webkit_uri_scheme_request_get_uri):
+        (webkit_uri_scheme_request_get_path):
+        (webkit_uri_scheme_request_get_web_view):
+        (webkitURISchemeRequestReadCallback):
+        (webkit_uri_scheme_request_finish_error):
+        * UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkitWebContextConstructed):
+        (webkitWebContextDispose):
+        (webkit_web_context_register_uri_scheme):
+        (webkitWebContextCreatePageForWebView):
+        * UIProcess/API/glib/WebKitWebContextPrivate.h:
+        * UIProcess/WebURLSchemeTask.h:
+        (WebKit::WebURLSchemeTask::request const):
+        * UIProcess/soup/WebProcessPoolSoup.cpp:
+
 2019-10-02  Zan Dobersek  <[email protected]>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (250596 => 250597)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -161,7 +161,7 @@
 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
     addSupplement<LegacyCustomProtocolManager>();
 #endif
-#if PLATFORM(COCOA) || USE(SOUP)
+#if PLATFORM(COCOA)
     LegacyCustomProtocolManager::networkProcessCreated(*this);
 #endif
 

Deleted: trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp (250596 => 250597)


--- trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,184 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitSoupRequestInputStream.h"
-
-#include <wtf/MainThread.h>
-#include <wtf/RunLoop.h>
-#include <wtf/glib/GRefPtr.h>
-#include <wtf/glib/GUniquePtr.h>
-
-struct AsyncReadData {
-    WTF_MAKE_STRUCT_FAST_ALLOCATED;
-    AsyncReadData(GRefPtr<GTask>&& task, void* buffer, gsize count)
-        : task(WTFMove(task))
-        , buffer(buffer)
-        , count(count)
-    {
-    }
-
-    GRefPtr<GTask> task;
-    void* buffer;
-    size_t count;
-};
-
-struct _WebKitSoupRequestInputStreamPrivate {
-    WTF_MAKE_STRUCT_FAST_ALLOCATED;
-    uint64_t contentLength;
-    uint64_t bytesReceived;
-    uint64_t bytesRead;
-
-    GUniquePtr<GError> error;
-
-    std::unique_ptr<AsyncReadData> pendingAsyncRead;
-};
-
-G_DEFINE_TYPE(WebKitSoupRequestInputStream, webkit_soup_request_input_stream, G_TYPE_MEMORY_INPUT_STREAM)
-
-static void webkitSoupRequestInputStreamReadAsyncResultComplete(GTask* task, void* buffer, gsize count)
-{
-    WebKitSoupRequestInputStream* stream = WEBKIT_SOUP_REQUEST_INPUT_STREAM(g_task_get_source_object(task));
-    GError* error = nullptr;
-    gssize bytesRead = G_INPUT_STREAM_GET_CLASS(stream)->read_fn(G_INPUT_STREAM(stream), buffer, count, g_task_get_cancellable(task), &error);
-    if (!error) {
-        stream->priv->bytesRead += bytesRead;
-        g_task_return_int(task, bytesRead);
-    } else
-        g_task_return_error(task, error);
-}
-
-static void webkitSoupRequestInputStreamPendingReadAsyncComplete(WebKitSoupRequestInputStream* stream)
-{
-    if (auto data = ""
-        webkitSoupRequestInputStreamReadAsyncResultComplete(data->task.get(), data->buffer, data->count);
-}
-
-static bool webkitSoupRequestInputStreamHasDataToRead(WebKitSoupRequestInputStream* stream)
-{
-    return stream->priv->bytesRead < stream->priv->bytesReceived;
-}
-
-static bool webkitSoupRequestInputStreamIsWaitingForData(WebKitSoupRequestInputStream* stream)
-{
-    return !stream->priv->contentLength || stream->priv->bytesReceived < stream->priv->contentLength;
-}
-
-static void webkitSoupRequestInputStreamReadAsync(GInputStream* inputStream, void* buffer, gsize count, int /*priority*/, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer userData)
-{
-    ASSERT(RunLoop::isMain());
-    WebKitSoupRequestInputStream* stream = WEBKIT_SOUP_REQUEST_INPUT_STREAM(inputStream);
-    GRefPtr<GTask> task = adoptGRef(g_task_new(stream, cancellable, callback, userData));
-
-    if (!webkitSoupRequestInputStreamHasDataToRead(stream) && !webkitSoupRequestInputStreamIsWaitingForData(stream)) {
-        g_task_return_int(task.get(), 0);
-        return;
-    }
-
-    if (stream->priv->error.get()) {
-        g_task_return_error(task.get(), stream->priv->error.release());
-        return;
-    }
-
-    if (webkitSoupRequestInputStreamHasDataToRead(stream)) {
-        webkitSoupRequestInputStreamReadAsyncResultComplete(task.get(), buffer, count);
-        return;
-    }
-
-    stream->priv->pendingAsyncRead = makeUnique<AsyncReadData>(WTFMove(task), buffer, count);
-}
-
-static gssize webkitSoupRequestInputStreamReadFinish(GInputStream* inputStream, GAsyncResult* result, GError** error)
-{
-    g_return_val_if_fail(g_task_is_valid(result, inputStream), 0);
-
-    return g_task_propagate_int(G_TASK(result), error);
-}
-
-static void webkitSoupRequestInputStreamFinalize(GObject* object)
-{
-    WEBKIT_SOUP_REQUEST_INPUT_STREAM(object)->priv->~WebKitSoupRequestInputStreamPrivate();
-    G_OBJECT_CLASS(webkit_soup_request_input_stream_parent_class)->finalize(object);
-}
-
-static void webkit_soup_request_input_stream_init(WebKitSoupRequestInputStream* stream)
-{
-    WebKitSoupRequestInputStreamPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(stream, WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM, WebKitSoupRequestInputStreamPrivate);
-    stream->priv = priv;
-    new (priv) WebKitSoupRequestInputStreamPrivate();
-}
-
-static void webkit_soup_request_input_stream_class_init(WebKitSoupRequestInputStreamClass* requestStreamClass)
-{
-    GObjectClass* gObjectClass = G_OBJECT_CLASS(requestStreamClass);
-    gObjectClass->finalize = webkitSoupRequestInputStreamFinalize;
-
-    GInputStreamClass* inputStreamClass = G_INPUT_STREAM_CLASS(requestStreamClass);
-    inputStreamClass->read_async = webkitSoupRequestInputStreamReadAsync;
-    inputStreamClass->read_finish = webkitSoupRequestInputStreamReadFinish;
-
-    g_type_class_add_private(requestStreamClass, sizeof(WebKitSoupRequestInputStreamPrivate));
-}
-
-GInputStream* webkitSoupRequestInputStreamNew(uint64_t contentLength)
-{
-    WebKitSoupRequestInputStream* stream = WEBKIT_SOUP_REQUEST_INPUT_STREAM(g_object_new(WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM, NULL));
-    stream->priv->contentLength = contentLength;
-    return G_INPUT_STREAM(stream);
-}
-
-void webkitSoupRequestInputStreamAddData(WebKitSoupRequestInputStream* stream, const void* data, size_t dataLength)
-{
-    ASSERT(RunLoop::isMain());
-
-    if (webkitSoupRequestInputStreamFinished(stream))
-        return;
-
-    if (dataLength) {
-        // Truncate the dataLength to the contentLength if it's known.
-        if (stream->priv->contentLength && stream->priv->bytesReceived + dataLength > stream->priv->contentLength)
-            dataLength = stream->priv->contentLength - stream->priv->bytesReceived;
-        stream->priv->bytesReceived += dataLength;
-        g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(stream), g_memdup(data, dataLength), dataLength, g_free);
-    } else {
-        // We have received all the data, set contentLength to bytesReceived to indicate we have finished.
-        stream->priv->contentLength = stream->priv->bytesReceived;
-        // If there's a pending read to complete, read_fn will return 0 because we haven't added more data to the
-        // memory input stream. And if there isn't a pending read, the next call to read_async will return 0 too, because
-        // webkitSoupRequestInputStreamFinished() is now TRUE.
-    }
-
-    webkitSoupRequestInputStreamPendingReadAsyncComplete(stream);
-}
-
-void webkitSoupRequestInputStreamDidFailWithError(WebKitSoupRequestInputStream* stream, const WebCore::ResourceError& resourceError)
-{
-    GUniquePtr<GError> error(g_error_new(g_quark_from_string(resourceError.domain().utf8().data()), resourceError.errorCode(), "%s", resourceError.localizedDescription().utf8().data()));
-    if (auto data = ""
-        g_task_return_error(data->task.get(), error.release());
-    else {
-        stream->priv->contentLength = stream->priv->bytesReceived;
-        stream->priv->error = WTFMove(error);
-    }
-}
-
-bool webkitSoupRequestInputStreamFinished(WebKitSoupRequestInputStream* stream)
-{
-    return !webkitSoupRequestInputStreamIsWaitingForData(stream);
-}

Deleted: trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h (250596 => 250597)


--- trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include <WebCore/ResourceError.h>
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-#define WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM            (webkit_soup_request_input_stream_get_type())
-#define WEBKIT_SOUP_REQUEST_INPUT_STREAM(object)         (G_TYPE_CHECK_INSTANCE_CAST((object), WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM, WebKitSoupRequestInputStream))
-#define WEBKIT_IS_SOUP_REQUEST_INPUT_STREAM(object)      (G_TYPE_CHECK_INSTANCE_TYPE((object), WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM))
-#define WEBKIT_SOUP_REQUEST_INPUT_STREAM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM, WebKitSoupRequestInputStreamClass))
-#define WEBKIT_IS_SOUP_REQUEST_INPUT_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM))
-#define WEBKIT_SOUP_REQUEST_INPUT_STREAM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_SOUP_REQUEST_INPUT_STREAM, WebKitSoupRequestInputStreamClass))
-
-typedef struct _WebKitSoupRequestInputStream WebKitSoupRequestInputStream;
-typedef struct _WebKitSoupRequestInputStreamClass WebKitSoupRequestInputStreamClass;
-typedef struct _WebKitSoupRequestInputStreamPrivate WebKitSoupRequestInputStreamPrivate;
-
-struct _WebKitSoupRequestInputStream {
-    GMemoryInputStream parent;
-
-    WebKitSoupRequestInputStreamPrivate* priv;
-};
-
-struct _WebKitSoupRequestInputStreamClass {
-    GMemoryInputStreamClass parent;
-};
-
-GType webkit_soup_request_input_stream_get_type();
-GInputStream* webkitSoupRequestInputStreamNew(uint64_t contentLength);
-void webkitSoupRequestInputStreamAddData(WebKitSoupRequestInputStream*, const void* data, size_t dataLength);
-void webkitSoupRequestInputStreamDidFailWithError(WebKitSoupRequestInputStream*, const WebCore::ResourceError&);
-bool webkitSoupRequestInputStreamFinished(WebKitSoupRequestInputStream*);
-
-G_END_DECLS

Modified: trunk/Source/WebKit/PlatformGTK.cmake (250596 => 250597)


--- trunk/Source/WebKit/PlatformGTK.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -33,12 +33,8 @@
 )
 
 list(APPEND WebKit_MESSAGES_IN_FILES
-    NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in
-
     UIProcess/ViewGestureController.messages.in
 
-    UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in
-
     WebProcess/WebPage/ViewGestureGeometryCollector.messages.in
 )
 
@@ -373,7 +369,6 @@
     "${FORWARDING_HEADERS_DIR}/_javascript_Core/"
     "${FORWARDING_HEADERS_DIR}/_javascript_Core/glib"
     "${WEBKIT_DIR}/PluginProcess/unix"
-    "${WEBKIT_DIR}/NetworkProcess/CustomProtocols/soup"
     "${WEBKIT_DIR}/NetworkProcess/glib"
     "${WEBKIT_DIR}/NetworkProcess/gtk"
     "${WEBKIT_DIR}/NetworkProcess/soup"
@@ -396,7 +391,6 @@
     "${WEBKIT_DIR}/UIProcess/API/glib"
     "${WEBKIT_DIR}/UIProcess/API/gtk"
     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
-    "${WEBKIT_DIR}/UIProcess/Network/CustomProtocols/soup"
     "${WEBKIT_DIR}/UIProcess/Plugins/gtk"
     "${WEBKIT_DIR}/UIProcess/geoclue"
     "${WEBKIT_DIR}/UIProcess/glib"

Modified: trunk/Source/WebKit/PlatformWPE.cmake (250596 => 250597)


--- trunk/Source/WebKit/PlatformWPE.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/PlatformWPE.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -75,12 +75,6 @@
     "SourcesWPE.txt"
 )
 
-list(APPEND WebKit_MESSAGES_IN_FILES
-    NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.messages.in
-
-    UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.messages.in
-)
-
 list(APPEND WebKit_DERIVED_SOURCES
     ${WebKit_DERIVED_SOURCES_DIR}/WebKitResourcesGResourceBundle.c
 
@@ -232,7 +226,6 @@
     "${FORWARDING_HEADERS_WPE_DOM_DIR}"
     "${DERIVED_SOURCES_DIR}"
     "${DERIVED_SOURCES_WPE_API_DIR}"
-    "${WEBKIT_DIR}/NetworkProcess/CustomProtocols/soup"
     "${WEBKIT_DIR}/NetworkProcess/glib"
     "${WEBKIT_DIR}/NetworkProcess/soup"
     "${WEBKIT_DIR}/NetworkProcess/unix"
@@ -252,7 +245,6 @@
     "${WEBKIT_DIR}/UIProcess/API/glib"
     "${WEBKIT_DIR}/UIProcess/API/wpe"
     "${WEBKIT_DIR}/UIProcess/CoordinatedGraphics"
-    "${WEBKIT_DIR}/UIProcess/Network/CustomProtocols/soup"
     "${WEBKIT_DIR}/UIProcess/geoclue"
     "${WEBKIT_DIR}/UIProcess/gstreamer"
     "${WEBKIT_DIR}/UIProcess/linux"

Modified: trunk/Source/WebKit/SourcesGTK.txt (250596 => 250597)


--- trunk/Source/WebKit/SourcesGTK.txt	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/SourcesGTK.txt	2019-10-02 08:00:33 UTC (rev 250597)
@@ -26,10 +26,6 @@
 
 NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
 
-NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
-
-NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
-
 NetworkProcess/cache/NetworkCacheDataSoup.cpp
 NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
 
@@ -41,7 +37,6 @@
 NetworkProcess/soup/NetworkProcessSoup.cpp
 NetworkProcess/soup/NetworkSessionSoup.cpp
 NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
-NetworkProcess/soup/WebKitSoupRequestInputStream.cpp
 NetworkProcess/soup/WebSocketTaskSoup.cpp
 
 NetworkProcess/webrtc/LibWebRTCSocketClient.cpp
@@ -134,7 +129,6 @@
 UIProcess/API/glib/WebKitContextMenuClient.cpp @no-unify
 UIProcess/API/glib/WebKitCookieManager.cpp @no-unify
 UIProcess/API/glib/WebKitCredential.cpp @no-unify
-UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp @no-unify
 UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp @no-unify
 UIProcess/API/glib/WebKitDownload.cpp @no-unify
 UIProcess/API/glib/WebKitDownloadClient.cpp @no-unify
@@ -215,8 +209,6 @@
 UIProcess/Launcher/glib/ProcessLauncherGLib.cpp @no-unify
 UIProcess/Launcher/glib/BubblewrapLauncher.cpp @no-unify
 
-UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp
-
 UIProcess/linux/MemoryPressureMonitor.cpp
 
 UIProcess/Plugins/gtk/PluginInfoCache.cpp

Modified: trunk/Source/WebKit/SourcesWPE.txt (250596 => 250597)


--- trunk/Source/WebKit/SourcesWPE.txt	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/SourcesWPE.txt	2019-10-02 08:00:33 UTC (rev 250597)
@@ -26,10 +26,6 @@
 
 NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
 
-NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
-
-NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
-
 NetworkProcess/cache/NetworkCacheDataSoup.cpp
 NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
 
@@ -41,7 +37,6 @@
 NetworkProcess/soup/NetworkProcessSoup.cpp
 NetworkProcess/soup/NetworkSessionSoup.cpp
 NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
-NetworkProcess/soup/WebKitSoupRequestInputStream.cpp
 NetworkProcess/soup/WebSocketTaskSoup.cpp
 
 NetworkProcess/webrtc/LibWebRTCSocketClient.cpp
@@ -123,7 +118,6 @@
 UIProcess/API/glib/WebKitContextMenuClient.cpp @no-unify
 UIProcess/API/glib/WebKitCookieManager.cpp @no-unify
 UIProcess/API/glib/WebKitCredential.cpp @no-unify
-UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp @no-unify
 UIProcess/API/glib/WebKitDeviceInfoPermissionRequest.cpp @no-unify
 UIProcess/API/glib/WebKitDownload.cpp @no-unify
 UIProcess/API/glib/WebKitDownloadClient.cpp @no-unify
@@ -197,8 +191,6 @@
 UIProcess/Launcher/glib/ProcessLauncherGLib.cpp
 UIProcess/Launcher/glib/BubblewrapLauncher.cpp
 
-UIProcess/Network/CustomProtocols/LegacyCustomProtocolManagerProxy.cpp
-
 UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp
 UIProcess/Plugins/unix/PluginProcessProxyUnix.cpp
 

Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2016 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "WebKitCustomProtocolManagerClient.h"
-
-#include "APICustomProtocolManagerClient.h"
-#include "LegacyCustomProtocolManagerProxy.h"
-#include "WebKitWebContextPrivate.h"
-#include "WebProcessPool.h"
-
-using namespace WebCore;
-using namespace WebKit;
-
-class CustomProtocolManagerClient final : public API::CustomProtocolManagerClient {
-public:
-    explicit CustomProtocolManagerClient(WebKitWebContext* webContext)
-        : m_webContext(webContext)
-    {
-    }
-
-private:
-    void startLoading(LegacyCustomProtocolManagerProxy& manager, uint64_t customProtocolID, const ResourceRequest& request) override
-    {
-        webkitWebContextStartLoadingCustomProtocol(m_webContext, customProtocolID, request, manager);
-    }
-
-    void stopLoading(LegacyCustomProtocolManagerProxy&, uint64_t customProtocolID) override
-    {
-        webkitWebContextStopLoadingCustomProtocol(m_webContext, customProtocolID);
-    }
-
-    void invalidate(LegacyCustomProtocolManagerProxy& manager) override
-    {
-        webkitWebContextInvalidateCustomProtocolRequests(m_webContext, manager);
-    }
-
-    WebKitWebContext* m_webContext;
-};
-
-void attachCustomProtocolManagerClientToContext(WebKitWebContext* webContext)
-{
-    webkitWebContextGetProcessPool(webContext).setLegacyCustomProtocolManagerClient(makeUnique<CustomProtocolManagerClient>(webContext));
-}

Deleted: trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2016 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "WebKitWebContext.h"
-
-void attachCustomProtocolManagerClientToContext(WebKitWebContext*);
-

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -58,9 +58,9 @@
 
 struct _WebKitURISchemeRequestPrivate {
     WebKitWebContext* webContext;
-    LegacyCustomProtocolManagerProxy* manager;
+    RefPtr<WebURLSchemeTask> task;
+
     RefPtr<WebPageProxy> initiatingPage;
-    uint64_t requestID;
     CString uri;
     GUniquePtr<SoupURI> soupURI;
 
@@ -78,18 +78,12 @@
 {
 }
 
-WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext* webContext, const ResourceRequest& resourceRequest, LegacyCustomProtocolManagerProxy& manager)
+WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext* webContext, WebPageProxy& page, WebURLSchemeTask& task)
 {
     WebKitURISchemeRequest* request = WEBKIT_URI_SCHEME_REQUEST(g_object_new(WEBKIT_TYPE_URI_SCHEME_REQUEST, nullptr));
     request->priv->webContext = webContext;
-    request->priv->manager = &manager;
-    request->priv->uri = resourceRequest.url().string().utf8();
-    request->priv->requestID = requestID;
-
-    ASSERT(resourceRequest.initiatingPageID());
-    request->priv->initiatingPage = WebProcessProxy::webPage(makeObjectIdentifier<WebPageProxyIdentifierType>(*resourceRequest.initiatingPageID()));
-    ASSERT(request->priv->initiatingPage);
-
+    request->priv->task = &task;
+    request->priv->initiatingPage = &page;
     return request;
 }
 
@@ -98,17 +92,6 @@
     g_cancellable_cancel(request->priv->cancellable.get());
 }
 
-LegacyCustomProtocolManagerProxy* webkitURISchemeRequestGetManager(WebKitURISchemeRequest* request)
-{
-    return request->priv->manager;
-}
-
-void webkitURISchemeRequestInvalidate(WebKitURISchemeRequest* request)
-{
-    request->priv->manager = nullptr;
-    webkitURISchemeRequestCancel(request);
-}
-
 /**
  * webkit_uri_scheme_request_get_scheme:
  * @request: a #WebKitURISchemeRequest
@@ -119,10 +102,11 @@
  */
 const char* webkit_uri_scheme_request_get_scheme(WebKitURISchemeRequest* request)
 {
-    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0);
+    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
     if (!request->priv->soupURI)
-        request->priv->soupURI.reset(soup_uri_new(request->priv->uri.data()));
+        request->priv->soupURI = urlToSoupURI(request->priv->task->request().url());
+
     return request->priv->soupURI->scheme;
 }
 
@@ -136,8 +120,11 @@
  */
 const char* webkit_uri_scheme_request_get_uri(WebKitURISchemeRequest* request)
 {
-    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0);
+    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
+    if (request->priv->uri.isNull())
+        request->priv->uri = request->priv->task->request().url().string().utf8();
+
     return request->priv->uri.data();
 }
 
@@ -151,10 +138,11 @@
  */
 const char* webkit_uri_scheme_request_get_path(WebKitURISchemeRequest* request)
 {
-    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0);
+    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
     if (!request->priv->soupURI)
-        request->priv->soupURI.reset(soup_uri_new(request->priv->uri.data()));
+        request->priv->soupURI = urlToSoupURI(request->priv->task->request().url());
+
     return request->priv->soupURI->path;
 }
 
@@ -168,7 +156,7 @@
  */
 WebKitWebView* webkit_uri_scheme_request_get_web_view(WebKitURISchemeRequest* request)
 {
-    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), 0);
+    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
     return webkitWebContextGetWebViewForPage(request->priv->webContext, request->priv->initiatingPage.get());
 }
@@ -176,42 +164,30 @@
 static void webkitURISchemeRequestReadCallback(GInputStream* inputStream, GAsyncResult* result, WebKitURISchemeRequest* schemeRequest)
 {
     GRefPtr<WebKitURISchemeRequest> request = adoptGRef(schemeRequest);
-    WebKitURISchemeRequestPrivate* priv = request->priv;
     GUniqueOutPtr<GError> error;
     gssize bytesRead = g_input_stream_read_finish(inputStream, result, &error.outPtr());
-    if (!priv->manager) {
-        webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
-        return;
-    }
-
     if (bytesRead == -1) {
         webkit_uri_scheme_request_finish_error(request.get(), error.get());
         return;
     }
 
+    WebKitURISchemeRequestPrivate* priv = request->priv;
     // Need to check the stream before proceeding as it can be cancelled if finish_error
     // was previously call, which won't be detected by g_input_stream_read_finish().
-    if (!request->priv->stream)
+    if (!priv->stream)
         return;
 
-    auto webData = IPC::DataReference(reinterpret_cast<const uint8_t*>(priv->readBuffer), bytesRead);
     if (!priv->bytesRead) {
-        // First chunk read. In case of empty reply an empty API::Data is sent to the networking process.
-        ResourceResponse response(URL(URL(), String::fromUTF8(priv->uri)), String::fromUTF8(priv->mimeType.data()),
-            priv->streamLength, emptyString());
-        priv->manager->didReceiveResponse(priv->requestID, response, 0);
-        priv->manager->didLoadData(priv->requestID, webData);
-    } else if (bytesRead || (!bytesRead && !priv->streamLength)) {
-        // Subsequent chunk read. We only send an empty API::Data to the networking process when stream length is unknown.
-        priv->manager->didLoadData(priv->requestID, webData);
+        ResourceResponse response(priv->task->request().url(), String::fromUTF8(priv->mimeType.data()), priv->streamLength, emptyString());
+        priv->task->didReceiveResponse(response);
     }
 
     if (!bytesRead) {
-        priv->manager->didFinishLoading(priv->requestID);
-        webkitWebContextDidFinishLoadingCustomProtocol(priv->webContext, priv->requestID);
+        priv->task->didComplete({ });
         return;
     }
 
+    priv->task->didReceiveData(SharedBuffer::create(priv->readBuffer, bytesRead));
     priv->bytesRead += bytesRead;
     g_input_stream_read_async(inputStream, priv->readBuffer, gReadBufferSize, RunLoopSourcePriority::AsyncIONetwork, priv->cancellable.get(),
         reinterpret_cast<GAsyncReadyCallback>(webkitURISchemeRequestReadCallback), g_object_ref(request.get()));
@@ -257,11 +233,7 @@
     g_return_if_fail(error);
 
     WebKitURISchemeRequestPrivate* priv = request->priv;
-    if (!webkitWebContextIsLoadingCustomProtocol(priv->webContext, priv->requestID))
-        return;
-
     priv->stream = nullptr;
-    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);
+    ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), priv->task->request().url(), String::fromUTF8(error->message));
+    priv->task->didComplete(resourceError);
 }

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -19,12 +19,11 @@
 
 #pragma once
 
-#include "LegacyCustomProtocolManagerProxy.h"
 #include "WebKitURISchemeRequest.h"
 #include "WebKitWebContext.h"
+#include "WebPageProxy.h"
+#include "WebURLSchemeTask.h"
 #include <WebCore/ResourceRequest.h>
 
-WebKitURISchemeRequest* webkitURISchemeRequestCreate(uint64_t requestID, WebKitWebContext*, const WebCore::ResourceRequest&, WebKit::LegacyCustomProtocolManagerProxy&);
+WebKitURISchemeRequest* webkitURISchemeRequestCreate(WebKitWebContext*, WebKit::WebPageProxy&, WebKit::WebURLSchemeTask&);
 void webkitURISchemeRequestCancel(WebKitURISchemeRequest*);
-WebKit::LegacyCustomProtocolManagerProxy* webkitURISchemeRequestGetManager(WebKitURISchemeRequest*);
-void webkitURISchemeRequestInvalidate(WebKitURISchemeRequest*);

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -21,7 +21,6 @@
 #include "WebKitWebContext.h"
 
 #include "APIAutomationClient.h"
-#include "APICustomProtocolManagerClient.h"
 #include "APIDownloadClient.h"
 #include "APIInjectedBundleClient.h"
 #include "APIPageConfiguration.h"
@@ -33,7 +32,6 @@
 #include "WebAutomationSession.h"
 #include "WebCertificateInfo.h"
 #include "WebKitAutomationSessionPrivate.h"
-#include "WebKitCustomProtocolManagerClient.h"
 #include "WebKitDownloadClient.h"
 #include "WebKitDownloadPrivate.h"
 #include "WebKitFaviconDatabasePrivate.h"
@@ -53,6 +51,7 @@
 #include "WebKitWebViewPrivate.h"
 #include "WebKitWebsiteDataManagerPrivate.h"
 #include "WebNotificationManagerProxy.h"
+#include "WebURLSchemeHandler.h"
 #include "WebsiteDataType.h"
 #include <_javascript_Core/RemoteInspector.h>
 #include <glib/gi18n-lib.h>
@@ -125,13 +124,11 @@
     LAST_SIGNAL
 };
 
-class WebKitURISchemeHandler: public RefCounted<WebKitURISchemeHandler> {
+class WebKitURISchemeHandler final : public WebURLSchemeHandler {
 public:
-    WebKitURISchemeHandler(WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify)
-        : m_callback(callback)
-        , m_userData(userData)
-        , m_destroyNotify(destroyNotify)
+    static Ref<WebKitURISchemeHandler> create(WebKitWebContext* context, WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify)
     {
+        return adoptRef(*new WebKitURISchemeHandler(context, callback, userData, destroyNotify));
     }
 
     ~WebKitURISchemeHandler()
@@ -140,22 +137,46 @@
             m_destroyNotify(m_userData);
     }
 
-    bool hasCallback()
+private:
+    WebKitURISchemeHandler(WebKitWebContext* context, WebKitURISchemeRequestCallback callback, void* userData, GDestroyNotify destroyNotify)
+        : m_context(context)
+        , m_callback(callback)
+        , m_userData(userData)
+        , m_destroyNotify(destroyNotify)
     {
-        return m_callback;
     }
 
-    void performCallback(WebKitURISchemeRequest* request)
+    void platformStartTask(WebPageProxy& page, WebURLSchemeTask& task) final
     {
-        ASSERT(m_callback);
+        if (!m_callback)
+            return;
 
-        m_callback(request, m_userData);
+        GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(m_context, page, task));
+        auto addResult = m_requests.add(task.identifier(), WTFMove(request));
+        ASSERT(addResult.isNewEntry);
+        m_callback(addResult.iterator->value.get(), m_userData);
     }
 
-private:
+    void platformStopTask(WebPageProxy&, WebURLSchemeTask& task) final
+    {
+        auto it = m_requests.find(task.identifier());
+        if (it == m_requests.end())
+            return;
+
+        webkitURISchemeRequestCancel(it->value.get());
+        m_requests.remove(it);
+    }
+
+    void platformTaskCompleted(WebURLSchemeTask& task) final
+    {
+        m_requests.remove(task.identifier());
+    }
+
+    WebKitWebContext* m_context { nullptr };
     WebKitURISchemeRequestCallback m_callback { nullptr };
     void* m_userData { nullptr };
     GDestroyNotify m_destroyNotify { nullptr };
+    HashMap<uint64_t, GRefPtr<WebKitURISchemeRequest>> m_requests;
 };
 
 typedef HashMap<String, RefPtr<WebKitURISchemeHandler> > URISchemeHandlerMap;
@@ -170,7 +191,6 @@
     GRefPtr<WebKitFaviconDatabase> faviconDatabase;
     GRefPtr<WebKitSecurityManager> securityManager;
     URISchemeHandlerMap uriSchemeHandlers;
-    URISchemeRequestMap uriSchemeRequests;
     GRefPtr<WebKitGeolocationManager> geolocationManager;
     std::unique_ptr<WebKitNotificationProvider> notificationProvider;
     GRefPtr<WebKitWebsiteDataManager> websiteDataManager;
@@ -347,7 +367,6 @@
 
     attachInjectedBundleClientToContext(webContext);
     attachDownloadClientToContext(webContext);
-    attachCustomProtocolManagerClientToContext(webContext);
 
     priv->geolocationManager = adoptGRef(webkitGeolocationManagerCreate(priv->processPool->supplement<WebGeolocationManagerProxy>()));
     priv->notificationProvider = makeUnique<WebKitNotificationProvider>(priv->processPool->supplement<WebNotificationManagerProxy>(), webContext);
@@ -364,7 +383,6 @@
         priv->clientsDetached = true;
         priv->processPool->setInjectedBundleClient(nullptr);
         priv->processPool->setDownloadClient(makeUniqueRef<API::DownloadClient>());
-        priv->processPool->setLegacyCustomProtocolManagerClient(nullptr);
     }
 
     if (priv->websiteDataManager) {
@@ -1114,10 +1132,10 @@
     g_return_if_fail(scheme);
     g_return_if_fail(callback);
 
-    RefPtr<WebKitURISchemeHandler> handler = adoptRef(new WebKitURISchemeHandler(callback, userData, destroyNotify));
-    auto addResult = context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), handler.get());
-    if (addResult.isNewEntry)
-        WebKit::WebProcessPool::registerGlobalURLSchemeAsHavingCustomProtocolHandlers(String::fromUTF8(scheme));
+    auto handler = WebKitURISchemeHandler::create(context, callback, userData, destroyNotify);
+    auto addResult = context->priv->uriSchemeHandlers.set(String::fromUTF8(scheme), WTFMove(handler));
+    for (auto* webView : context->priv->webViews.values())
+        webkitWebViewGetPage(webView).setURLSchemeHandlerForScheme(*addResult.iterator->value, String::fromUTF8(scheme));
 }
 
 /**
@@ -1664,45 +1682,6 @@
     return *context->priv->processPool;
 }
 
-void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID, const WebCore::ResourceRequest& resourceRequest, LegacyCustomProtocolManagerProxy& manager)
-{
-    GRefPtr<WebKitURISchemeRequest> request = adoptGRef(webkitURISchemeRequestCreate(customProtocolID, context, resourceRequest, manager));
-    String scheme(String::fromUTF8(webkit_uri_scheme_request_get_scheme(request.get())));
-    RefPtr<WebKitURISchemeHandler> handler = context->priv->uriSchemeHandlers.get(scheme);
-    ASSERT(handler.get());
-    if (!handler->hasCallback())
-        return;
-
-    context->priv->uriSchemeRequests.set(customProtocolID, request.get());
-    handler->performCallback(request.get());
-}
-
-void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID)
-{
-    GRefPtr<WebKitURISchemeRequest> request = context->priv->uriSchemeRequests.get(customProtocolID);
-    if (!request.get())
-        return;
-    webkitURISchemeRequestCancel(request.get());
-}
-
-void webkitWebContextInvalidateCustomProtocolRequests(WebKitWebContext* context, LegacyCustomProtocolManagerProxy& manager)
-{
-    for (auto& request : copyToVector(context->priv->uriSchemeRequests.values())) {
-        if (webkitURISchemeRequestGetManager(request.get()) == &manager)
-            webkitURISchemeRequestInvalidate(request.get());
-    }
-}
-
-void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID)
-{
-    context->priv->uriSchemeRequests.remove(customProtocolID);
-}
-
-bool webkitWebContextIsLoadingCustomProtocol(WebKitWebContext* context, uint64_t customProtocolID)
-{
-    return context->priv->uriSchemeRequests.get(customProtocolID);
-}
-
 void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebView* webView, WebKitUserContentManager* userContentManager, WebKitWebView* relatedView)
 {
     auto pageConfiguration = API::PageConfiguration::create();
@@ -1718,6 +1697,12 @@
     pageConfiguration->setWebsiteDataStore(&webkitWebsiteDataManagerGetDataStore(manager));
     webkitWebViewCreatePage(webView, WTFMove(pageConfiguration));
 
+    auto& page = webkitWebViewGetPage(webView);
+    for (auto& it : context->priv->uriSchemeHandlers) {
+        Ref<WebURLSchemeHandler> handler(*it.value);
+        page.setURLSchemeHandlerForScheme(WTFMove(handler), it.key);
+    }
+
     context->priv->webViews.set(webkit_web_view_get_page_id(webView), webView);
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContextPrivate.h (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContextPrivate.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContextPrivate.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "DownloadProxy.h"
-#include "LegacyCustomProtocolManagerProxy.h"
 #include "WebKitUserContentManager.h"
 #include "WebKitWebContext.h"
 #include "WebProcessPool.h"
@@ -37,11 +36,6 @@
 WebKitDownload* webkitWebContextStartDownload(WebKitWebContext*, const char* uri, WebKit::WebPageProxy*);
 void webkitWebContextRemoveDownload(WebKit::DownloadProxy*);
 void webkitWebContextDownloadStarted(WebKitWebContext*, WebKitDownload*);
-void webkitWebContextStartLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID, const WebCore::ResourceRequest&, WebKit::LegacyCustomProtocolManagerProxy&);
-void webkitWebContextStopLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
-void webkitWebContextInvalidateCustomProtocolRequests(WebKitWebContext*, WebKit::LegacyCustomProtocolManagerProxy&);
-void webkitWebContextDidFinishLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
-bool webkitWebContextIsLoadingCustomProtocol(WebKitWebContext*, uint64_t customProtocolID);
 void webkitWebContextCreatePageForWebView(WebKitWebContext*, WebKitWebView*, WebKitUserContentManager*, WebKitWebView*);
 void webkitWebContextWebViewDestroyed(WebKitWebContext*, WebKitWebView*);
 WebKitWebView* webkitWebContextGetWebViewForPage(WebKitWebContext*, WebKit::WebPageProxy*);

Modified: trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/WebURLSchemeTask.h	2019-10-02 08:00:33 UTC (rev 250597)
@@ -62,13 +62,11 @@
     WebPageProxyIdentifier pageProxyID() const { ASSERT(RunLoop::isMain()); return m_pageProxyID; }
     WebCore::PageIdentifier webPageID() const { ASSERT(RunLoop::isMain()); return m_webPageID; }
     WebProcessProxy* process() { ASSERT(RunLoop::isMain()); return m_process.get(); }
+    const WebCore::ResourceRequest& request() const { ASSERT(RunLoop::isMain()); return m_request; }
 
 #if PLATFORM(COCOA)
     NSURLRequest *nsRequest() const;
 #endif
-#if PLATFORM(WIN)
-    const WebCore::ResourceRequest& request() const { ASSERT(RunLoop::isMain()); return m_request; }
-#endif
 
     enum class ExceptionType {
         DataAlreadySent,

Modified: trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp (250596 => 250597)


--- trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "WebProcessPool.h"
 
-#include "APICustomProtocolManagerClient.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
 #include "WebCookieManagerProxy.h"

Modified: trunk/Source/cmake/OptionsFTW.cmake (250596 => 250597)


--- trunk/Source/cmake/OptionsFTW.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/cmake/OptionsFTW.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -90,7 +90,6 @@
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_KEYBOARD_CODE_ATTRIBUTE PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_KEYBOARD_KEY_ATTRIBUTE PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES PRIVATE ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MAC_GESTURE_EVENTS PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PRIVATE ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PRIVATE ON)

Modified: trunk/Source/cmake/OptionsPlayStation.cmake (250596 => 250597)


--- trunk/Source/cmake/OptionsPlayStation.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/cmake/OptionsPlayStation.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -38,7 +38,6 @@
 # No support planned
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_METER_ELEMENT PRIVATE OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)

Modified: trunk/Source/cmake/OptionsWin.cmake (250596 => 250597)


--- trunk/Source/cmake/OptionsWin.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/cmake/OptionsWin.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -75,7 +75,6 @@
 
 if (${WTF_PLATFORM_WIN_CAIRO})
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTL PUBLIC ON)
-    WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER PUBLIC OFF)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC OFF)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)

Modified: trunk/Source/cmake/WebKitFeatures.cmake (250596 => 250597)


--- trunk/Source/cmake/WebKitFeatures.cmake	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Source/cmake/WebKitFeatures.cmake	2019-10-02 08:00:33 UTC (rev 250597)
@@ -156,7 +156,7 @@
     WEBKIT_OPTION_DEFINE(ENABLE_KEYBOARD_KEY_ATTRIBUTE "Toggle keyboard key attribute support" PRIVATE ON)
     WEBKIT_OPTION_DEFINE(ENABLE_LAYOUT_FORMATTING_CONTEXT "Toggle Layout Formatting Context support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES "Toggle legacy css vendor prefix support" PRIVATE OFF)
-    WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER "Toggle legacy protocol manager support" PRIVATE ON)
+    WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_CUSTOM_PROTOCOL_MANAGER "Toggle legacy protocol manager support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_ENCRYPTED_MEDIA "Toggle Legacy EME V2 support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_LETTERPRESS "Toggle letterpress support" PRIVATE OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_MAC_GESTURE_EVENTS "Toggle Mac gesture events support" PRIVATE OFF)

Modified: trunk/Tools/ChangeLog (250596 => 250597)


--- trunk/Tools/ChangeLog	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Tools/ChangeLog	2019-10-02 08:00:33 UTC (rev 250597)
@@ -1,3 +1,15 @@
+2019-10-02  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Stop using legacy custom protocol implementation
+        https://bugs.webkit.org/show_bug.cgi?id=202407
+
+        Reviewed by Žan Doberšek.
+
+        Remove the tests to check failure after committed, because it's not possible to test it with current code.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
+        (testWebContextURIScheme):
+
 2019-10-01  Alexey Shvayka  <[email protected]>
 
         [win-ews] No such file or directory: u'/cygdrive/C/cygwin/home/buildbot/WebKit/WebKitBuild/Release/bin32/layout-test-results/pywebsocket.ws.log-out.txt'

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp (250596 => 250597)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp	2019-10-02 07:45:34 UTC (rev 250596)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp	2019-10-02 08:00:33 UTC (rev 250597)
@@ -161,7 +161,6 @@
 
 static const char* genericErrorMessage = "Error message.";
 static const char* beforeReceiveResponseErrorMessage = "Error before didReceiveResponse.";
-static const char* afterInitialChunkErrorMessage = "Error after reading the initial chunk.";
 
 class URISchemeTest: public LoadTrackingTest {
 public:
@@ -240,26 +239,8 @@
         webkit_web_context_register_uri_scheme(m_webContext.get(), scheme, uriSchemeRequestCallback, this, 0);
     }
 
-    void loadCommitted() override
-    {
-        if (m_finishOnCommitted) {
-            GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(errorDomain), errorCode, afterInitialChunkErrorMessage));
-            webkit_uri_scheme_request_finish_error(m_uriSchemeRequest.get(), error.get());
-        }
-
-        LoadTrackingTest::loadCommitted();
-    }
-
-    void finishOnCommittedAndWaitUntilLoadFinished()
-    {
-        m_finishOnCommitted = true;
-        waitUntilLoadFinished();
-        m_finishOnCommitted = false;
-    }
-
     GRefPtr<WebKitURISchemeRequest> m_uriSchemeRequest;
     HashMap<String, URISchemeHandler> m_handlersMap;
-    bool m_finishOnCommitted { false };
 };
 
 String generateHTMLContent(unsigned contentLength)
@@ -318,13 +299,13 @@
     g_assert_cmpint(mainResourceDataSize, ==, strlen(echoHTML.get()));
     g_assert_cmpint(strncmp(mainResourceData, echoHTML.get(), mainResourceDataSize), ==, 0);
 
-    test->registerURISchemeHandler("nomime", kBarHTML, -1, 0);
+    test->registerURISchemeHandler("nomime", kBarHTML, -1, nullptr);
     test->m_loadEvents.clear();
     test->loadURI("nomime:foo-bar");
     test->waitUntilLoadFinished();
     g_assert_true(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
 
-    test->registerURISchemeHandler("empty", 0, 0, "text/html");
+    test->registerURISchemeHandler("empty", nullptr, 0, "text/html");
     test->m_loadEvents.clear();
     test->loadURI("empty:nothing");
     test->waitUntilLoadFinished();
@@ -352,17 +333,8 @@
     g_assert_error(test->m_error.get(), g_quark_from_string(errorDomain), errorCode);
     g_assert_cmpstr(test->m_error->message, ==, beforeReceiveResponseErrorMessage);
 
+    test->registerURISchemeHandler("closed", nullptr, 0, nullptr);
     test->m_loadEvents.clear();
-    test->loadURI("error:after-first-chunk");
-    test->finishOnCommittedAndWaitUntilLoadFinished();
-    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
-    g_assert_true(test->m_loadEvents.contains(LoadTrackingTest::LoadFailed));
-    g_assert_true(test->m_loadFailed);
-    g_assert_error(test->m_error.get(), g_quark_from_string(errorDomain), errorCode);
-    g_assert_cmpstr(test->m_error->message, ==, afterInitialChunkErrorMessage);
-
-    test->registerURISchemeHandler("closed", 0, 0, 0);
-    test->m_loadEvents.clear();
     test->loadURI("closed:input-stream");
     test->waitUntilLoadFinished();
     g_assert_true(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to