[GTK][WPE] Stop using legacy custom protocol implementation
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2019 08:00:33 +0000 (08:00 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2019 08:00:33 +0000 (08:00 +0000)
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):

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

27 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp [deleted file]
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp [deleted file]
Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h [deleted file]
Source/WebKit/PlatformGTK.cmake
Source/WebKit/PlatformWPE.cmake
Source/WebKit/SourcesGTK.txt
Source/WebKit/SourcesWPE.txt
Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp [deleted file]
Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h [deleted file]
Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp
Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContextPrivate.h
Source/WebKit/UIProcess/WebURLSchemeTask.h
Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp
Source/cmake/OptionsFTW.cmake
Source/cmake/OptionsPlayStation.cmake
Source/cmake/OptionsWin.cmake
Source/cmake/WebKitFeatures.cmake
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp

index a03a19e..d61b31e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [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  <zdobersek@igalia.com>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
index 796ac91..649126f 100644 (file)
@@ -1,3 +1,16 @@
+2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [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  <zdobersek@igalia.com>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
index 096de5f..46c8d45 100644 (file)
@@ -45,7 +45,6 @@
 namespace WebCore {
 
 static bool gIgnoreTLSErrors;
-static GType gCustomProtocolRequestType;
 
 static CString& initialAcceptLanguages()
 {
@@ -134,8 +133,6 @@ SoupNetworkSession::SoupNetworkSession(PAL::SessionID sessionID)
 #endif
         nullptr);
 
-    setupCustomProtocols();
-
     if (!initialAcceptLanguages().isNull())
         setAcceptLanguages(initialAcceptLanguages());
 
@@ -337,24 +334,6 @@ void SoupNetworkSession::setAcceptLanguages(const CString& languages)
     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;
index eccda41..72b6507 100644 (file)
@@ -72,9 +72,6 @@ public:
     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);
index 992448c..451d1d7 100644 (file)
@@ -1,3 +1,43 @@
+2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [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  <zdobersek@igalia.com>
 
         [Nicosia] Enable async scrolling at build-time for Nicosia-using ports
diff --git a/Source/WebKit/NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp b/Source/WebKit/NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
deleted file mode 100644 (file)
index c9b0c3b..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2013 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 "LegacyCustomProtocolManager.h"
-
-#include "DataReference.h"
-#include "LegacyCustomProtocolManagerMessages.h"
-#include "NetworkProcess.h"
-#include "NetworkSessionSoup.h"
-#include "WebKitSoupRequestInputStream.h"
-#include <WebCore/NotImplemented.h>
-#include <WebCore/ResourceError.h>
-#include <WebCore/ResourceRequest.h>
-#include <WebCore/ResourceResponse.h>
-#include <WebCore/SoupNetworkSession.h>
-#include <WebCore/WebKitSoupRequestGeneric.h>
-#include <wtf/NeverDestroyed.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-RefPtr<NetworkProcess>& lastCreatedNetworkProcess()
-{
-    static NeverDestroyed<RefPtr<NetworkProcess>> networkProcess;
-    return networkProcess.get();
-}
-
-void LegacyCustomProtocolManager::networkProcessCreated(NetworkProcess& networkProcess)
-{
-    lastCreatedNetworkProcess() = &networkProcess;
-}
-
-LegacyCustomProtocolManager::WebSoupRequestAsyncData::WebSoupRequestAsyncData(GRefPtr<GTask>&& requestTask, WebKitSoupRequestGeneric* requestGeneric)
-    : task(WTFMove(requestTask))
-    , request(requestGeneric)
-    , cancellable(g_task_get_cancellable(task.get()))
-{
-    // If the struct contains a null request, it is because the request failed.
-    g_object_add_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request));
-}
-
-LegacyCustomProtocolManager::WebSoupRequestAsyncData::~WebSoupRequestAsyncData()
-{
-    if (request)
-        g_object_remove_weak_pointer(G_OBJECT(request), reinterpret_cast<void**>(&request));
-}
-
-class CustomProtocolRequestClient final : public WebKitSoupRequestGenericClient {
-public:
-    static CustomProtocolRequestClient& singleton()
-    {
-        static NeverDestroyed<CustomProtocolRequestClient> client;
-        return client;
-    }
-
-private:
-    void startRequest(GRefPtr<GTask>&& task) override
-    {
-        WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(task.get()));
-        auto* customProtocolManager = lastCreatedNetworkProcess()->supplement<LegacyCustomProtocolManager>();
-        if (!customProtocolManager)
-            return;
-
-        auto customProtocolID = customProtocolManager->addCustomProtocol(makeUnique<LegacyCustomProtocolManager::WebSoupRequestAsyncData>(WTFMove(task), request));
-        customProtocolManager->startLoading(customProtocolID, webkitSoupRequestGenericGetRequest(request));
-    }
-};
-
-void LegacyCustomProtocolManager::registerProtocolClass()
-{
-    static_cast<WebKitSoupRequestGenericClass*>(g_type_class_ref(WEBKIT_TYPE_SOUP_REQUEST_GENERIC))->client = &CustomProtocolRequestClient::singleton();
-    SoupNetworkSession::setCustomProtocolRequestType(WEBKIT_TYPE_SOUP_REQUEST_GENERIC);
-}
-
-void LegacyCustomProtocolManager::registerScheme(const String& scheme)
-{
-    if (!m_registeredSchemes)
-        m_registeredSchemes = adoptGRef(g_ptr_array_new_with_free_func(g_free));
-
-    if (m_registeredSchemes->len)
-        g_ptr_array_remove_index_fast(m_registeredSchemes.get(), m_registeredSchemes->len - 1);
-    g_ptr_array_add(m_registeredSchemes.get(), g_strdup(scheme.utf8().data()));
-    g_ptr_array_add(m_registeredSchemes.get(), nullptr);
-
-    auto* genericRequestClass = static_cast<SoupRequestClass*>(g_type_class_peek(WEBKIT_TYPE_SOUP_REQUEST_GENERIC));
-    ASSERT(genericRequestClass);
-    genericRequestClass->schemes = const_cast<const char**>(reinterpret_cast<char**>(m_registeredSchemes->pdata));
-    lastCreatedNetworkProcess()->forEachNetworkSession([](const auto& session) {
-        static_cast<const NetworkSessionSoup&>(session).soupNetworkSession().setupCustomProtocols();
-    });
-}
-
-void LegacyCustomProtocolManager::unregisterScheme(const String&)
-{
-    notImplemented();
-}
-
-bool LegacyCustomProtocolManager::supportsScheme(const String& scheme)
-{
-    if (scheme.isNull())
-        return false;
-
-    CString cScheme = scheme.utf8();
-    for (unsigned i = 0; i < m_registeredSchemes->len; ++i) {
-        if (cScheme == static_cast<char*>(g_ptr_array_index(m_registeredSchemes.get(), i)))
-            return true;
-    }
-
-    return false;
-}
-
-void LegacyCustomProtocolManager::didFailWithError(uint64_t customProtocolID, const ResourceError& error)
-{
-    auto* data = m_customProtocolMap.get(customProtocolID);
-    ASSERT(data);
-
-    // Either we haven't started reading the stream yet, in which case we need to complete the
-    // task first, or we failed reading it and the task was already completed by didLoadData().
-    ASSERT(!data->stream || !data->task);
-
-    if (!data->stream) {
-        GRefPtr<GTask> task = std::exchange(data->task, nullptr);
-        ASSERT(task.get());
-        g_task_return_new_error(task.get(), g_quark_from_string(error.domain().utf8().data()),
-            error.errorCode(), "%s", error.localizedDescription().utf8().data());
-    } else
-        webkitSoupRequestInputStreamDidFailWithError(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), error);
-
-    removeCustomProtocol(customProtocolID);
-}
-
-void LegacyCustomProtocolManager::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference)
-{
-    auto* data = m_customProtocolMap.get(customProtocolID);
-    // The data might have been removed from the request map if a previous chunk failed
-    // and a new message was sent by the UI process before being notified about the failure.
-    if (!data)
-        return;
-
-    if (!data->stream) {
-        GRefPtr<GTask> task = std::exchange(data->task, nullptr);
-        ASSERT(task.get());
-
-        goffset soupContentLength = soup_request_get_content_length(SOUP_REQUEST(g_task_get_source_object(task.get())));
-        uint64_t contentLength = soupContentLength == -1 ? 0 : static_cast<uint64_t>(soupContentLength);
-        if (!dataReference.size()) {
-            // Empty reply, just create and empty GMemoryInputStream.
-            data->stream = g_memory_input_stream_new();
-        } else if (dataReference.size() == contentLength) {
-            // We don't expect more data, so we can just create a GMemoryInputStream with all the data.
-            data->stream = g_memory_input_stream_new_from_data(g_memdup(dataReference.data(), dataReference.size()), contentLength, g_free);
-        } else {
-            // We expect more data chunks from the UI process.
-            data->stream = webkitSoupRequestInputStreamNew(contentLength);
-            webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size());
-        }
-        g_task_return_pointer(task.get(), data->stream.get(), g_object_unref);
-        return;
-    }
-
-    if (g_cancellable_is_cancelled(data->cancellable.get()) || !data->request) {
-        // ResourceRequest failed or it was cancelled. It doesn't matter here the error or if it was cancelled,
-        // because that's already handled by the resource handle client, we just want to notify the UI process
-        // to stop reading data from the user input stream. If UI process already sent all the data we simply
-        // finish silently.
-        if (!webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get())))
-            stopLoading(customProtocolID);
-
-        return;
-    }
-
-    webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size());
-}
-
-void LegacyCustomProtocolManager::didReceiveResponse(uint64_t customProtocolID, const ResourceResponse& response, uint32_t)
-{
-    auto* data = m_customProtocolMap.get(customProtocolID);
-    // The data might have been removed from the request map if an error happened even before this point.
-    if (!data)
-        return;
-
-    ASSERT(data->task);
-
-    WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(data->task.get()));
-    webkitSoupRequestGenericSetContentLength(request, response.expectedContentLength() ? response.expectedContentLength() : -1);
-    webkitSoupRequestGenericSetContentType(request, !response.mimeType().isEmpty() ? response.mimeType().utf8().data() : 0);
-}
-
-void LegacyCustomProtocolManager::didFinishLoading(uint64_t customProtocolID)
-{
-    ASSERT(m_customProtocolMap.contains(customProtocolID));
-    removeCustomProtocol(customProtocolID);
-}
-
-void LegacyCustomProtocolManager::wasRedirectedToRequest(uint64_t, const ResourceRequest&, const ResourceResponse&)
-{
-    notImplemented();
-}
-
-} // namespace WebKit
index 4cd38c2..dc25c6b 100644 (file)
@@ -161,7 +161,7 @@ NetworkProcess::NetworkProcess(AuxiliaryProcessInitializationParameters&& parame
 #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER)
     addSupplement<LegacyCustomProtocolManager>();
 #endif
-#if PLATFORM(COCOA) || USE(SOUP)
+#if PLATFORM(COCOA)
     LegacyCustomProtocolManager::networkProcessCreated(*this);
 #endif
 
diff --git a/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp b/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.cpp
deleted file mode 100644 (file)
index 874525e..0000000
+++ /dev/null
@@ -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 = WTFMove(stream->priv->pendingAsyncRead))
-        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 = WTFMove(stream->priv->pendingAsyncRead))
-        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);
-}
diff --git a/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h b/Source/WebKit/NetworkProcess/soup/WebKitSoupRequestInputStream.h
deleted file mode 100644 (file)
index 399b0b4..0000000
+++ /dev/null
@@ -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
index 2bf5d0e..3f39ae3 100644 (file)
@@ -33,12 +33,8 @@ list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
 )
 
 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 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/"
     "${FORWARDING_HEADERS_DIR}/JavaScriptCore/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 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${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"
index 570a41c..8977421 100644 (file)
@@ -75,12 +75,6 @@ list(APPEND WebKit_UNIFIED_SOURCE_LIST_FILES
     "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 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${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 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${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"
index 55d18c2..1e4e42c 100644 (file)
@@ -26,10 +26,6 @@ NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp
 
 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/NetworkProcessMainSoup.cpp
 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/WebKitBackForwardListItem.cpp @no-unify
 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/geoclue/GeoclueGeolocationProvider.cpp
 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
index 2485bb6..a22e4f1 100644 (file)
@@ -26,10 +26,6 @@ NetworkProcess/Classifier/WebResourceLoadStatisticsTelemetry.cpp
 
 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/NetworkProcessMainSoup.cpp
 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/WebKitBackForwardListItem.cpp @no-unify
 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/glib/WebsiteDataStoreGLib.cpp @no-unify
 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
 
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp b/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.cpp
deleted file mode 100644 (file)
index a373b29..0000000
+++ /dev/null
@@ -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));
-}
diff --git a/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h b/Source/WebKit/UIProcess/API/glib/WebKitCustomProtocolManagerClient.h
deleted file mode 100644 (file)
index c9c4c17..0000000
+++ /dev/null
@@ -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*);
-
index 4427940..95bbdca 100644 (file)
@@ -58,9 +58,9 @@ static const unsigned int gReadBufferSize = 8192;
 
 struct _WebKitURISchemeRequestPrivate {
     WebKitWebContext* webContext;
-    LegacyCustomProtocolManagerProxy* manager;
+    RefPtr<WebURLSchemeTask> task;
+
     RefPtr<WebPageProxy> initiatingPage;
-    uint64_t requestID;
     CString uri;
     GUniquePtr<SoupURI> soupURI;
 
@@ -78,18 +78,12 @@ static void webkit_uri_scheme_request_class_init(WebKitURISchemeRequestClass*)
 {
 }
 
-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 @@ void webkitURISchemeRequestCancel(WebKitURISchemeRequest* request)
     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 @@ void webkitURISchemeRequestInvalidate(WebKitURISchemeRequest* request)
  */
 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,7 +120,10 @@ const char* webkit_uri_scheme_request_get_scheme(WebKitURISchemeRequest* request
  */
 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_uri(WebKitURISchemeRequest* request)
  */
 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 @@ const char* webkit_uri_scheme_request_get_path(WebKitURISchemeRequest* request)
  */
 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 @@ WebKitWebView* webkit_uri_scheme_request_get_web_view(WebKitURISchemeRequest* re
 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 @@ void webkit_uri_scheme_request_finish_error(WebKitURISchemeRequest* request, GEr
     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);
 }
index bc2df28..01849e1 100644 (file)
 
 #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*);
index 4b79caa..a344096 100644 (file)
@@ -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 <JavaScriptCore/RemoteInspector.h>
 #include <glib/gi18n-lib.h>
@@ -125,13 +124,11 @@ enum {
     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 @@ public:
             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 @@ struct _WebKitWebContextPrivate {
     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 @@ static void webkitWebContextConstructed(GObject* object)
 
     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 @@ static void webkitWebContextDispose(GObject* object)
         priv->clientsDetached = true;
         priv->processPool->setInjectedBundleClient(nullptr);
         priv->processPool->setDownloadClient(makeUniqueRef<API::DownloadClient>());
-        priv->processPool->setLegacyCustomProtocolManagerClient(nullptr);
     }
 
     if (priv->websiteDataManager) {
@@ -1114,10 +1132,10 @@ void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const cha
     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 @@ WebProcessPool& webkitWebContextGetProcessPool(WebKitWebContext* context)
     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 @@ void webkitWebContextCreatePageForWebView(WebKitWebContext* context, WebKitWebVi
     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);
 }
 
index 6adb52b..d8569c8 100644 (file)
@@ -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* webkitWebContextGetOrCreateDownload(WebKit::DownloadProxy*);
 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*);
index bfd9233..4d6d2f3 100644 (file)
@@ -62,13 +62,11 @@ public:
     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,
index ee42491..59ee788 100644 (file)
@@ -26,7 +26,6 @@
 #include "config.h"
 #include "WebProcessPool.h"
 
-#include "APICustomProtocolManagerClient.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
 #include "WebCookieManagerProxy.h"
index 611a4d9..6cf389a 100644 (file)
@@ -90,7 +90,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTERSECTION_OBSERVER PRIVATE ON)
 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)
index b4ddba4..5935911 100644 (file)
@@ -38,7 +38,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE OFF)
 # 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)
index 07153ee..cbdc301 100644 (file)
@@ -75,7 +75,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE ON)
 
 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)
index 871be29..e301abd 100644 (file)
@@ -156,7 +156,7 @@ macro(WEBKIT_OPTION_BEGIN)
     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)
index a5625d7..8231c00 100644 (file)
@@ -1,3 +1,15 @@
+2019-10-02  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [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  <shvaikalesh@gmail.com>
 
         [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'
index 6160ae7..36c1838 100644 (file)
@@ -161,7 +161,6 @@ static const int errorCode = 10;
 
 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 @@ public:
         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 @@ static void testWebContextURIScheme(URISchemeTest* test, gconstpointer)
     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,16 +333,7 @@ static void testWebContextURIScheme(URISchemeTest* test, gconstpointer)
     g_assert_error(test->m_error.get(), g_quark_from_string(errorDomain), errorCode);
     g_assert_cmpstr(test->m_error->message, ==, beforeReceiveResponseErrorMessage);
 
-    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->registerURISchemeHandler("closed", nullptr, 0, nullptr);
     test->m_loadEvents.clear();
     test->loadURI("closed:input-stream");
     test->waitUntilLoadFinished();