[GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2020 16:14:55 +0000 (16:14 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2020 16:14:55 +0000 (16:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=216927

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2020-09-24
Reviewed by Alex Christensen.

Source/WebCore:

Make proxySettings a member of SoupNetworkSession, instead of being global.

* platform/network/soup/SoupNetworkSession.cpp:
(WebCore::SoupNetworkSession::SoupNetworkSession):
(WebCore::SoupNetworkSession::setProxySettings):
(WebCore::proxySettings): Deleted.
(WebCore::SoupNetworkSession::setupProxy): Deleted.
* platform/network/soup/SoupNetworkSession.h:

Source/WebKit:

Make proxy settings per session instead of global to the network process. The web context API now simply
forwards the request to the website data manager.

* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformInitializeNetworkProcess):
(WebKit::NetworkProcess::setNetworkProxySettings):
* NetworkProcess/soup/NetworkSessionSoup.cpp:
(WebKit::NetworkSessionSoup::NetworkSessionSoup):
(WebKit::NetworkSessionSoup::setProxySettings):
* NetworkProcess/soup/NetworkSessionSoup.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/API/glib/WebKitAutomationSession.cpp:
(webkitAutomationSessionCreate):
* UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_set_network_proxy_settings):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkitWebViewConstructed):
* UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
(webkit_website_data_manager_set_network_proxy_settings):
* UIProcess/API/gtk/WebKitNetworkProxySettings.h:
* UIProcess/API/gtk/WebKitWebContext.h:
* UIProcess/API/gtk/WebKitWebsiteDataManager.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitNetworkProxySettings.h:
* UIProcess/API/wpe/WebKitWebContext.h:
* UIProcess/API/wpe/WebKitWebsiteDataManager.h:
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::networkProxySettings const):
* UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
(WebKit::WebsiteDataStore::platformSetNetworkParameters):
(WebKit::WebsiteDataStore::setNetworkProxySettings):
* UIProcess/glib/WebProcessPoolGLib.cpp:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/soup/WebProcessPoolSoup.cpp:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
(WebKit::WebProcessPool::setNetworkProxySettings): Deleted.

Tools:

Use the new API in tests.

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

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

34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/soup/SoupNetworkSession.cpp
Source/WebCore/platform/network/soup/SoupNetworkSession.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.cpp
Source/WebKit/NetworkProcess/soup/NetworkSessionSoup.h
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebsiteDataManager.cpp
Source/WebKit/UIProcess/API/gtk/WebKitNetworkProxySettings.h
Source/WebKit/UIProcess/API/gtk/WebKitWebContext.h
Source/WebKit/UIProcess/API/gtk/WebKitWebsiteDataManager.h
Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
Source/WebKit/UIProcess/API/wpe/WebKitNetworkProxySettings.h
Source/WebKit/UIProcess/API/wpe/WebKitWebContext.h
Source/WebKit/UIProcess/API/wpe/WebKitWebsiteDataManager.h
Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp
Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp
Source/WebKit/UIProcess/soup/WebProcessPoolSoup.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp

index a50ead2..1b4513d 100644 (file)
@@ -1,3 +1,19 @@
+2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager
+        https://bugs.webkit.org/show_bug.cgi?id=216927
+
+        Reviewed by Alex Christensen.
+
+        Make proxySettings a member of SoupNetworkSession, instead of being global.
+
+        * platform/network/soup/SoupNetworkSession.cpp:
+        (WebCore::SoupNetworkSession::SoupNetworkSession):
+        (WebCore::SoupNetworkSession::setProxySettings):
+        (WebCore::proxySettings): Deleted.
+        (WebCore::SoupNetworkSession::setupProxy): Deleted.
+        * platform/network/soup/SoupNetworkSession.h:
+
 2020-09-24  Chris Dumez  <cdumez@apple.com>
 
         web audio api outputs silence for 302 redirected resource in safari
index c89f805..59d11dc 100644 (file)
@@ -32,7 +32,6 @@
 #include "AuthenticationChallenge.h"
 #include "GUniquePtrSoup.h"
 #include "Logging.h"
-#include "SoupNetworkProxySettings.h"
 #include <glib/gstdio.h>
 #include <libsoup/soup.h>
 #include <pal/crypto/CryptoDigest.h>
@@ -50,12 +49,6 @@ static CString& initialAcceptLanguages()
     return storage.get();
 }
 
-static SoupNetworkProxySettings& proxySettings()
-{
-    static NeverDestroyed<SoupNetworkProxySettings> settings;
-    return settings.get();
-}
-
 #if !LOG_DISABLED || !RELEASE_LOG_DISABLED
 inline static void soupLogPrinter(SoupLogger*, SoupLoggerLogLevel, char direction, const char* data, gpointer)
 {
@@ -142,8 +135,6 @@ SoupNetworkSession::SoupNetworkSession(PAL::SessionID sessionID)
             nullptr);
     }
 
-    if (proxySettings().mode != SoupNetworkProxySettings::Mode::Default)
-        setupProxy();
     setupLogger();
 }
 
@@ -277,10 +268,12 @@ void SoupNetworkSession::clearOldSoupCache(const String& cacheDirectory)
     }
 }
 
-void SoupNetworkSession::setupProxy()
+void SoupNetworkSession::setProxySettings(SoupNetworkProxySettings&& settings)
 {
+    m_proxySettings = WTFMove(settings);
+
     GRefPtr<GProxyResolver> resolver;
-    switch (proxySettings().mode) {
+    switch (m_proxySettings.mode) {
     case SoupNetworkProxySettings::Mode::Default: {
         GRefPtr<GProxyResolver> currentResolver;
         g_object_get(m_soupSession.get(), SOUP_SESSION_PROXY_RESOLVER, &currentResolver.outPtr(), nullptr);
@@ -295,11 +288,11 @@ void SoupNetworkSession::setupProxy()
         break;
     case SoupNetworkProxySettings::Mode::Custom:
         resolver = adoptGRef(g_simple_proxy_resolver_new(nullptr, nullptr));
-        if (!proxySettings().defaultProxyURL.isNull())
-            g_simple_proxy_resolver_set_default_proxy(G_SIMPLE_PROXY_RESOLVER(resolver.get()), proxySettings().defaultProxyURL.data());
-        if (proxySettings().ignoreHosts)
-            g_simple_proxy_resolver_set_ignore_hosts(G_SIMPLE_PROXY_RESOLVER(resolver.get()), proxySettings().ignoreHosts.get());
-        for (const auto& iter : proxySettings().proxyMap)
+        if (!m_proxySettings.defaultProxyURL.isNull())
+            g_simple_proxy_resolver_set_default_proxy(G_SIMPLE_PROXY_RESOLVER(resolver.get()), m_proxySettings.defaultProxyURL.data());
+        if (m_proxySettings.ignoreHosts)
+            g_simple_proxy_resolver_set_ignore_hosts(G_SIMPLE_PROXY_RESOLVER(resolver.get()), m_proxySettings.ignoreHosts.get());
+        for (const auto& iter : m_proxySettings.proxyMap)
             g_simple_proxy_resolver_set_uri_proxy(G_SIMPLE_PROXY_RESOLVER(resolver.get()), iter.key.data(), iter.value.data());
         break;
     }
@@ -308,11 +301,6 @@ void SoupNetworkSession::setupProxy()
     soup_session_abort(m_soupSession.get());
 }
 
-void SoupNetworkSession::setProxySettings(const SoupNetworkProxySettings& settings)
-{
-    proxySettings() = settings;
-}
-
 void SoupNetworkSession::setInitialAcceptLanguages(const CString& languages)
 {
     initialAcceptLanguages() = languages;
index d06d77e..d082b70 100644 (file)
@@ -25,6 +25,7 @@
 
 #pragma once
 
+#include "SoupNetworkProxySettings.h"
 #include <gio/gio.h>
 #include <glib-object.h>
 #include <pal/SessionID.h>
@@ -43,7 +44,6 @@ namespace WebCore {
 
 class CertificateInfo;
 class ResourceError;
-struct SoupNetworkProxySettings;
 
 class SoupNetworkSession {
     WTF_MAKE_NONCOPYABLE(SoupNetworkSession); WTF_MAKE_FAST_ALLOCATED;
@@ -60,8 +60,7 @@ public:
 
     static void clearOldSoupCache(const String& cacheDirectory);
 
-    static void setProxySettings(const SoupNetworkProxySettings&);
-    void setupProxy();
+    void setProxySettings(SoupNetworkProxySettings&&);
 
     static void setInitialAcceptLanguages(const CString&);
     void setAcceptLanguages(const CString&);
@@ -80,6 +79,7 @@ private:
     GRefPtr<SoupSession> m_soupSession;
     PAL::SessionID m_sessionID;
     bool m_ignoreTLSErrors { false };
+    SoupNetworkProxySettings m_proxySettings;
 };
 
 } // namespace WebCore
index 3db7568..9c19df4 100644 (file)
@@ -1,5 +1,64 @@
 2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        [GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager
+        https://bugs.webkit.org/show_bug.cgi?id=216927
+
+        Reviewed by Alex Christensen.
+
+        Make proxy settings per session instead of global to the network process. The web context API now simply
+        forwards the request to the website data manager.
+
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode const):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * NetworkProcess/NetworkSessionCreationParameters.cpp:
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/NetworkSessionCreationParameters.h:
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcess):
+        (WebKit::NetworkProcess::setNetworkProxySettings):
+        * NetworkProcess/soup/NetworkSessionSoup.cpp:
+        (WebKit::NetworkSessionSoup::NetworkSessionSoup):
+        (WebKit::NetworkSessionSoup::setProxySettings):
+        * NetworkProcess/soup/NetworkSessionSoup.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/API/glib/WebKitAutomationSession.cpp:
+        (webkitAutomationSessionCreate):
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        (webkit_web_context_set_network_proxy_settings):
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkitWebViewConstructed):
+        * UIProcess/API/glib/WebKitWebsiteDataManager.cpp:
+        (webkit_website_data_manager_set_network_proxy_settings):
+        * UIProcess/API/gtk/WebKitNetworkProxySettings.h:
+        * UIProcess/API/gtk/WebKitWebContext.h:
+        * UIProcess/API/gtk/WebKitWebsiteDataManager.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+        * UIProcess/API/wpe/WebKitNetworkProxySettings.h:
+        * UIProcess/API/wpe/WebKitWebContext.h:
+        * UIProcess/API/wpe/WebKitWebsiteDataManager.h:
+        * UIProcess/API/wpe/docs/wpe-1.0-sections.txt:
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::networkProxySettings const):
+        * UIProcess/WebsiteData/soup/WebsiteDataStoreSoup.cpp:
+        (WebKit::WebsiteDataStore::platformSetNetworkParameters):
+        (WebKit::WebsiteDataStore::setNetworkProxySettings):
+        * UIProcess/glib/WebProcessPoolGLib.cpp:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * UIProcess/soup/WebProcessPoolSoup.cpp:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        (WebKit::WebProcessPool::setNetworkProxySettings): Deleted.
+
+2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         REGRESSION(r267502): [GTK][WPE] ephemeral WebKitWebsiteDataManager ignores TLS errors by default
         https://bugs.webkit.org/show_bug.cgi?id=216919
 
index df4fcfd..6ad3d69 100644 (file)
@@ -447,7 +447,7 @@ private:
 #if USE(SOUP)
     void setIgnoreTLSErrors(PAL::SessionID, bool);
     void userPreferredLanguagesChanged(const Vector<String>&);
-    void setNetworkProxySettings(const WebCore::SoupNetworkProxySettings&);
+    void setNetworkProxySettings(PAL::SessionID, WebCore::SoupNetworkProxySettings&&);
     void setPersistentCredentialStorageEnabled(PAL::SessionID, bool);
 #endif
 
index 84e3340..99ad840 100644 (file)
@@ -30,7 +30,7 @@ messages -> NetworkProcess LegacyReceiver {
 #if USE(SOUP)
     SetIgnoreTLSErrors(PAL::SessionID sessionID, bool ignoreTLSErrors)
     UserPreferredLanguagesChanged(Vector<String> languages)
-    SetNetworkProxySettings(struct WebCore::SoupNetworkProxySettings settings)
+    SetNetworkProxySettings(PAL::SessionID sessionID, struct WebCore::SoupNetworkProxySettings settings)
     PrefetchDNS(String hostname)
     SetPersistentCredentialStorageEnabled(PAL::SessionID sessionID, bool enabled)
 #endif
index 0f84fd6..cc5c44b 100644 (file)
@@ -59,7 +59,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #if USE(SOUP)
     encoder << cookieAcceptPolicy;
     encoder << languages;
-    encoder << proxySettings;
 #endif
 
     encoder << urlSchemesRegisteredAsSecure;
@@ -126,8 +125,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
         return false;
     if (!decoder.decode(result.languages))
         return false;
-    if (!decoder.decode(result.proxySettings))
-        return false;
 #endif
 
     if (!decoder.decode(result.urlSchemesRegisteredAsSecure))
index 7762182..dff3e5f 100644 (file)
@@ -35,7 +35,6 @@
 
 #if USE(SOUP)
 #include <WebCore/HTTPCookieAcceptPolicy.h>
-#include <WebCore/SoupNetworkProxySettings.h>
 #endif
 
 namespace IPC {
@@ -76,7 +75,6 @@ struct NetworkProcessCreationParameters {
 #if USE(SOUP)
     WebCore::HTTPCookieAcceptPolicy cookieAcceptPolicy { WebCore::HTTPCookieAcceptPolicy::AlwaysAccept };
     Vector<String> languages;
-    WebCore::SoupNetworkProxySettings proxySettings;
 #endif
 
     Vector<String> urlSchemesRegisteredAsSecure;
index 78ef099..a9f1cd7 100644 (file)
@@ -64,6 +64,7 @@ void NetworkSessionCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << cookiePersistentStorageType;
     encoder << persistentCredentialStorageEnabled;
     encoder << ignoreTLSErrors;
+    encoder << proxySettings;
 #endif
 #if USE(CURL)
     encoder << cookiePersistentStorageFile;
@@ -187,6 +188,11 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
     decoder >> ignoreTLSErrors;
     if (!ignoreTLSErrors)
         return WTF::nullopt;
+
+    Optional<WebCore::SoupNetworkProxySettings> proxySettings;
+    decoder >> proxySettings;
+    if (!proxySettings)
+        return WTF::nullopt;
 #endif
 
 #if USE(CURL)
@@ -306,6 +312,7 @@ Optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters::dec
         , WTFMove(*cookiePersistentStorageType)
         , WTFMove(*persistentCredentialStorageEnabled)
         , WTFMove(*ignoreTLSErrors)
+        , WTFMove(*proxySettings)
 #endif
 #if USE(CURL)
         , WTFMove(*cookiePersistentStorageFile)
index fb0ef16..9eba07b 100644 (file)
@@ -33,6 +33,7 @@
 
 #if USE(SOUP)
 #include "SoupCookiePersistentStorageType.h"
+#include <WebCore/SoupNetworkProxySettings.h>
 #endif
 
 #if USE(CURL)
@@ -76,6 +77,7 @@ struct NetworkSessionCreationParameters {
     SoupCookiePersistentStorageType cookiePersistentStorageType { SoupCookiePersistentStorageType::Text };
     bool persistentCredentialStorageEnabled { true };
     bool ignoreTLSErrors { false };
+    WebCore::SoupNetworkProxySettings proxySettings;
 #endif
 #if USE(CURL)
     String cookiePersistentStorageFile;
index 64b1a77..a212845 100644 (file)
@@ -125,9 +125,6 @@ void NetworkProcess::userPreferredLanguagesChanged(const Vector<String>& languag
 
 void NetworkProcess::platformInitializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
 {
-    if (parameters.proxySettings.mode != SoupNetworkProxySettings::Mode::Default)
-        setNetworkProxySettings(parameters.proxySettings);
-
     GRefPtr<GResolver> cachedResolver = adoptGRef(webkitCachedResolverNew(adoptGRef(g_resolver_get_default())));
     g_resolver_set_default(cachedResolver.get());
 
@@ -168,12 +165,10 @@ void NetworkProcess::platformTerminate()
     notImplemented();
 }
 
-void NetworkProcess::setNetworkProxySettings(const SoupNetworkProxySettings& settings)
+void NetworkProcess::setNetworkProxySettings(PAL::SessionID sessionID, SoupNetworkProxySettings&& settings)
 {
-    SoupNetworkSession::setProxySettings(settings);
-    forEachNetworkSession([](const auto& session) {
-        static_cast<const NetworkSessionSoup&>(session).soupNetworkSession().setupProxy();
-    });
+    if (auto* session = networkSession(sessionID))
+        static_cast<NetworkSessionSoup&>(*session).setProxySettings(WTFMove(settings));
 }
 
 void NetworkProcess::setPersistentCredentialStorageEnabled(PAL::SessionID sessionID, bool enabled)
index 2ef3fcb..66ff36e 100644 (file)
@@ -49,6 +49,9 @@ NetworkSessionSoup::NetworkSessionSoup(NetworkProcess& networkProcess, NetworkSe
 
     setIgnoreTLSErrors(parameters.ignoreTLSErrors);
 
+    if (parameters.proxySettings.mode != SoupNetworkProxySettings::Mode::Default)
+        setProxySettings(WTFMove(parameters.proxySettings));
+
     if (!parameters.cookiePersistentStoragePath.isEmpty())
         setCookiePersistentStorage(parameters.cookiePersistentStoragePath, parameters.cookiePersistentStorageType);
     else
@@ -136,4 +139,9 @@ void NetworkSessionSoup::setIgnoreTLSErrors(bool ignoreTLSErrors)
     m_networkSession->setIgnoreTLSErrors(ignoreTLSErrors);
 }
 
+void NetworkSessionSoup::setProxySettings(SoupNetworkProxySettings&& settings)
+{
+    m_networkSession->setProxySettings(WTFMove(settings));
+}
+
 } // namespace WebKit
index ac34fe9..9a01468 100644 (file)
@@ -32,6 +32,7 @@ typedef struct _SoupSession SoupSession;
 
 namespace WebCore {
 class SoupNetworkSession;
+struct SoupNetworkProxySettings;
 }
 
 namespace WebKit {
@@ -58,6 +59,7 @@ public:
     bool persistentCredentialStorageEnabled() const { return m_persistentCredentialStorageEnabled; }
 
     void setIgnoreTLSErrors(bool);
+    void setProxySettings(WebCore::SoupNetworkProxySettings&&);
 
 private:
     std::unique_ptr<WebSocketTask> createWebSocketTask(NetworkSocketChannel&, const WebCore::ResourceRequest&, const String& protocol) final;
index 514f1c8..c7a59a0 100644 (file)
@@ -130,10 +130,6 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << waylandCompositorDisplayName;
 #endif
 
-#if USE(SOUP)
-    encoder << proxySettings;
-#endif
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
     encoder << shouldLogUserInteraction;
 #endif
@@ -377,11 +373,6 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
         return false;
 #endif
 
-#if USE(SOUP)
-    if (!decoder.decode(parameters.proxySettings))
-        return false;
-#endif
-
 #if ENABLE(RESOURCE_LOAD_STATISTICS) && !RELEASE_LOG_DISABLED
     if (!decoder.decode(parameters.shouldLogUserInteraction))
         return false;
index 5272252..0d3a296 100644 (file)
 #include <wtf/MachSendRight.h>
 #endif
 
-#if USE(SOUP)
-#include <WebCore/HTTPCookieAcceptPolicy.h>
-#include <WebCore/SoupNetworkProxySettings.h>
-#endif
-
 #if PLATFORM(IOS_FAMILY)
 #include <WebCore/RenderThemeIOS.h>
 #endif
@@ -174,10 +169,6 @@ struct WebProcessCreationParameters {
     String waylandCompositorDisplayName;
 #endif
 
-#if USE(SOUP)
-    WebCore::SoupNetworkProxySettings proxySettings;
-#endif
-
 #if PLATFORM(COCOA)
     Vector<String> mediaMIMETypes;
     WebCore::ScreenProperties screenProperties;
index 37f0a44..43afd35 100644 (file)
@@ -360,7 +360,7 @@ WebKitAutomationSession* webkitAutomationSessionCreate(WebKitWebContext* webCont
     if (capabilities.proxy) {
         WebKitNetworkProxySettings* proxySettings = nullptr;
         auto proxyMode = parseProxyCapabilities(*capabilities.proxy, &proxySettings);
-        webkit_web_context_set_network_proxy_settings(webContext, proxyMode, proxySettings);
+        webkit_website_data_manager_set_network_proxy_settings(webkit_web_context_get_website_data_manager(webContext), proxyMode, proxySettings);
         if (proxySettings)
             webkit_network_proxy_settings_free(proxySettings);
     }
index fae6235..71667cf 100644 (file)
@@ -39,7 +39,6 @@
 #include "WebKitGeolocationManagerPrivate.h"
 #include "WebKitInitialize.h"
 #include "WebKitInjectedBundleClient.h"
-#include "WebKitNetworkProxySettingsPrivate.h"
 #include "WebKitNotificationProvider.h"
 #include "WebKitPrivate.h"
 #include "WebKitProtocolHandler.h"
@@ -935,29 +934,14 @@ void webkit_web_context_clear_cache(WebKitWebContext* context)
  * a valid #WebKitNetworkProxySettings; otherwise, @proxy_settings must be %NULL.
  *
  * Since: 2.16
+ *
+ * Deprecated: 2.32. Use webkit_website_data_manager_set_network_proxy_settings() instead.
  */
 void webkit_web_context_set_network_proxy_settings(WebKitWebContext* context, WebKitNetworkProxyMode proxyMode, WebKitNetworkProxySettings* proxySettings)
 {
     g_return_if_fail(WEBKIT_IS_WEB_CONTEXT(context));
-    g_return_if_fail((proxyMode != WEBKIT_NETWORK_PROXY_MODE_CUSTOM && !proxySettings) || (proxyMode == WEBKIT_NETWORK_PROXY_MODE_CUSTOM && proxySettings));
 
-    WebKitWebContextPrivate* priv = context->priv;
-    switch (proxyMode) {
-    case WEBKIT_NETWORK_PROXY_MODE_DEFAULT:
-        priv->processPool->setNetworkProxySettings({ });
-        break;
-    case WEBKIT_NETWORK_PROXY_MODE_NO_PROXY:
-        priv->processPool->setNetworkProxySettings(WebCore::SoupNetworkProxySettings(WebCore::SoupNetworkProxySettings::Mode::NoProxy));
-        break;
-    case WEBKIT_NETWORK_PROXY_MODE_CUSTOM:
-        const auto& settings = webkitNetworkProxySettingsGetNetworkProxySettings(proxySettings);
-        if (settings.isEmpty()) {
-            g_warning("Invalid attempt to set custom network proxy settings with an empty WebKitNetworkProxySettings. Use "
-                "WEBKIT_NETWORK_PROXY_MODE_NO_PROXY to not use any proxy or WEBKIT_NETWORK_PROXY_MODE_DEFAULT to use the default system settings");
-        } else
-            priv->processPool->setNetworkProxySettings(settings);
-        break;
-    }
+    webkit_website_data_manager_set_network_proxy_settings(context->priv->websiteDataManager.get(), proxyMode, proxySettings);
 }
 
 typedef HashMap<DownloadProxy*, GRefPtr<WebKitDownload> > DownloadsMap;
index b377007..4135c26 100644 (file)
@@ -757,6 +757,8 @@ static void webkitWebViewConstructed(GObject* object)
         priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new_ephemeral());
         auto* contextDataManager = webkit_web_context_get_website_data_manager(priv->context.get());
         webkit_website_data_manager_set_tls_errors_policy(priv->websiteDataManager.get(), webkit_website_data_manager_get_tls_errors_policy(contextDataManager));
+        auto proxySettings = webkitWebsiteDataManagerGetDataStore(contextDataManager).networkProxySettings();
+        webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get()).setNetworkProxySettings(WTFMove(proxySettings));
         webkitWebsiteDataManagerAddProcessPool(priv->websiteDataManager.get(), webkitWebContextGetProcessPool(priv->context.get()));
     }
 
index dec58fc..da9a3aa 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "WebKitCookieManagerPrivate.h"
 #include "WebKitInitialize.h"
+#include "WebKitNetworkProxySettingsPrivate.h"
 #include "WebKitPrivate.h"
 #include "WebKitWebsiteDataManagerPrivate.h"
 #include "WebKitWebsiteDataPrivate.h"
@@ -952,6 +953,47 @@ WebKitTLSErrorsPolicy webkit_website_data_manager_get_tls_errors_policy(WebKitWe
     return manager->priv->tlsErrorsPolicy;
 }
 
+/**
+ * webkit_website_data_manager_set_network_proxy_settings:
+ * @manager: a #WebKitWebsiteDataManager
+ * @proxy_mode: a #WebKitNetworkProxyMode
+ * @proxy_settings: (allow-none): a #WebKitNetworkProxySettings, or %NULL
+ *
+ * Set the network proxy settings to be used by connections started in @manager session.
+ * By default %WEBKIT_NETWORK_PROXY_MODE_DEFAULT is used, which means that the
+ * system settings will be used (g_proxy_resolver_get_default()).
+ * If you want to override the system default settings, you can either use
+ * %WEBKIT_NETWORK_PROXY_MODE_NO_PROXY to make sure no proxies are used at all,
+ * or %WEBKIT_NETWORK_PROXY_MODE_CUSTOM to provide your own proxy settings.
+ * When @proxy_mode is %WEBKIT_NETWORK_PROXY_MODE_CUSTOM @proxy_settings must be
+ * a valid #WebKitNetworkProxySettings; otherwise, @proxy_settings must be %NULL.
+ *
+ * Since: 2.32
+ */
+void webkit_website_data_manager_set_network_proxy_settings(WebKitWebsiteDataManager* manager, WebKitNetworkProxyMode proxyMode, WebKitNetworkProxySettings* proxySettings)
+{
+    g_return_if_fail(WEBKIT_IS_WEBSITE_DATA_MANAGER(manager));
+    g_return_if_fail((proxyMode != WEBKIT_NETWORK_PROXY_MODE_CUSTOM && !proxySettings) || (proxyMode == WEBKIT_NETWORK_PROXY_MODE_CUSTOM && proxySettings));
+
+    auto& dataStore = webkitWebsiteDataManagerGetDataStore(manager);
+    switch (proxyMode) {
+    case WEBKIT_NETWORK_PROXY_MODE_DEFAULT:
+        dataStore.setNetworkProxySettings({ });
+        break;
+    case WEBKIT_NETWORK_PROXY_MODE_NO_PROXY:
+        dataStore.setNetworkProxySettings(WebCore::SoupNetworkProxySettings(WebCore::SoupNetworkProxySettings::Mode::NoProxy));
+        break;
+    case WEBKIT_NETWORK_PROXY_MODE_CUSTOM:
+        auto settings = webkitNetworkProxySettingsGetNetworkProxySettings(proxySettings);
+        if (settings.isEmpty()) {
+            g_warning("Invalid attempt to set custom network proxy settings with an empty WebKitNetworkProxySettings. Use "
+                "WEBKIT_NETWORK_PROXY_MODE_NO_PROXY to not use any proxy or WEBKIT_NETWORK_PROXY_MODE_DEFAULT to use the default system settings");
+        } else
+            dataStore.setNetworkProxySettings(WTFMove(settings));
+        break;
+    }
+}
+
 static OptionSet<WebsiteDataType> toWebsiteDataTypes(WebKitWebsiteDataTypes types)
 {
     OptionSet<WebsiteDataType> returnValue;
index 00c2b39..49f6a87 100644 (file)
@@ -31,6 +31,22 @@ G_BEGIN_DECLS
 
 #define WEBKIT_TYPE_NETWORK_NETWORK_PROXY_SETTINGS (webkit_network_proxy_settings_get_type())
 
+/**
+ * WebKitNetworkProxyMode:
+ * @WEBKIT_NETWORK_PROXY_MODE_DEFAULT: Use the default proxy of the system.
+ * @WEBKIT_NETWORK_PROXY_MODE_NO_PROXY: Do not use any proxy.
+ * @WEBKIT_NETWORK_PROXY_MODE_CUSTOM: Use custom proxy settings.
+ *
+ * Enum values used to set the network proxy mode.
+ *
+ * Since: 2.16
+ */
+typedef enum {
+    WEBKIT_NETWORK_PROXY_MODE_DEFAULT,
+    WEBKIT_NETWORK_PROXY_MODE_NO_PROXY,
+    WEBKIT_NETWORK_PROXY_MODE_CUSTOM
+} WebKitNetworkProxyMode;
+
 typedef struct _WebKitNetworkProxySettings WebKitNetworkProxySettings;
 
 WEBKIT_API GType
index 5078bc7..5a4adf8 100644 (file)
@@ -89,22 +89,6 @@ typedef enum {
 } WebKitProcessModel;
 
 /**
- * WebKitNetworkProxyMode:
- * @WEBKIT_NETWORK_PROXY_MODE_DEFAULT: Use the default proxy of the system.
- * @WEBKIT_NETWORK_PROXY_MODE_NO_PROXY: Do not use any proxy.
- * @WEBKIT_NETWORK_PROXY_MODE_CUSTOM: Use custom proxy settings.
- *
- * Enum values used to set the network proxy mode.
- *
- * Since: 2.16
- */
-typedef enum {
-    WEBKIT_NETWORK_PROXY_MODE_DEFAULT,
-    WEBKIT_NETWORK_PROXY_MODE_NO_PROXY,
-    WEBKIT_NETWORK_PROXY_MODE_CUSTOM
-} WebKitNetworkProxyMode;
-
-/**
  * WebKitURISchemeRequestCallback:
  * @request: the #WebKitURISchemeRequest
  * @user_data: user data passed to the callback
@@ -186,7 +170,7 @@ webkit_web_context_get_web_process_count_limit      (WebKitWebContext
 WEBKIT_API void
 webkit_web_context_clear_cache                      (WebKitWebContext              *context);
 
-WEBKIT_API void
+WEBKIT_DEPRECATED_FOR(webkit_website_data_manager_set_network_proxy_settings) void
 webkit_web_context_set_network_proxy_settings       (WebKitWebContext              *context,
                                                      WebKitNetworkProxyMode         proxy_mode,
                                                      WebKitNetworkProxySettings    *proxy_settings);
index 3f67b04..567cd0e 100644 (file)
@@ -27,6 +27,7 @@
 #include <gio/gio.h>
 #include <webkit2/WebKitCookieManager.h>
 #include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitNetworkProxySettings.h>
 #include <webkit2/WebKitWebsiteData.h>
 
 G_BEGIN_DECLS
@@ -142,6 +143,11 @@ WEBKIT_API WebKitTLSErrorsPolicy
 webkit_website_data_manager_get_tls_errors_policy                     (WebKitWebsiteDataManager *manager);
 
 WEBKIT_API void
+webkit_website_data_manager_set_network_proxy_settings                (WebKitWebsiteDataManager *manager,
+                                                                       WebKitNetworkProxyMode    proxy_mode,
+                                                                       WebKitNetworkProxySettings *proxy_settings);
+
+WEBKIT_API void
 webkit_website_data_manager_fetch                                     (WebKitWebsiteDataManager *manager,
                                                                        WebKitWebsiteDataTypes    types,
                                                                        GCancellable             *cancellable,
index 1dcea01..640384c 100644 (file)
@@ -26,7 +26,6 @@ WEBKIT_DEPRECATED_FOR
 WebKitWebContext
 WebKitCacheModel
 WebKitProcessModel
-WebKitNetworkProxyMode
 webkit_web_context_get_default
 webkit_web_context_new
 webkit_web_context_new_ephemeral
@@ -1474,6 +1473,7 @@ webkit_website_data_manager_set_persistent_credential_storage_enabled
 webkit_website_data_manager_get_persistent_credential_storage_enabled
 webkit_website_data_manager_set_tls_errors_policy
 webkit_website_data_manager_get_tls_errors_policy
+webkit_website_data_manager_set_network_proxy_settings
 webkit_website_data_manager_fetch
 webkit_website_data_manager_fetch_finish
 webkit_website_data_manager_remove
@@ -1536,6 +1536,7 @@ webkit_website_data_get_type
 <SECTION>
 <FILE>WebKitNetworkProxySettings</FILE>
 WebKitNetworkProxySettings
+WebKitNetworkProxyMode
 webkit_network_proxy_settings_new
 webkit_network_proxy_settings_copy
 webkit_network_proxy_settings_free
index cb5657c..efd29c4 100644 (file)
@@ -31,6 +31,22 @@ G_BEGIN_DECLS
 
 #define WEBKIT_TYPE_NETWORK_NETWORK_PROXY_SETTINGS (webkit_network_proxy_settings_get_type())
 
+/**
+ * WebKitNetworkProxyMode:
+ * @WEBKIT_NETWORK_PROXY_MODE_DEFAULT: Use the default proxy of the system.
+ * @WEBKIT_NETWORK_PROXY_MODE_NO_PROXY: Do not use any proxy.
+ * @WEBKIT_NETWORK_PROXY_MODE_CUSTOM: Use custom proxy settings.
+ *
+ * Enum values used to set the network proxy mode.
+ *
+ * Since: 2.16
+ */
+typedef enum {
+    WEBKIT_NETWORK_PROXY_MODE_DEFAULT,
+    WEBKIT_NETWORK_PROXY_MODE_NO_PROXY,
+    WEBKIT_NETWORK_PROXY_MODE_CUSTOM
+} WebKitNetworkProxyMode;
+
 typedef struct _WebKitNetworkProxySettings WebKitNetworkProxySettings;
 
 WEBKIT_API GType
index 2cc7047..4ce93a4 100644 (file)
@@ -89,22 +89,6 @@ typedef enum {
 } WebKitProcessModel;
 
 /**
- * WebKitNetworkProxyMode:
- * @WEBKIT_NETWORK_PROXY_MODE_DEFAULT: Use the default proxy of the system.
- * @WEBKIT_NETWORK_PROXY_MODE_NO_PROXY: Do not use any proxy.
- * @WEBKIT_NETWORK_PROXY_MODE_CUSTOM: Use custom proxy settings.
- *
- * Enum values used to set the network proxy mode.
- *
- * Since: 2.16
- */
-typedef enum {
-    WEBKIT_NETWORK_PROXY_MODE_DEFAULT,
-    WEBKIT_NETWORK_PROXY_MODE_NO_PROXY,
-    WEBKIT_NETWORK_PROXY_MODE_CUSTOM
-} WebKitNetworkProxyMode;
-
-/**
  * WebKitURISchemeRequestCallback:
  * @request: the #WebKitURISchemeRequest
  * @user_data: user data passed to the callback
@@ -186,7 +170,7 @@ webkit_web_context_get_web_process_count_limit      (WebKitWebContext
 WEBKIT_API void
 webkit_web_context_clear_cache                      (WebKitWebContext              *context);
 
-WEBKIT_API void
+WEBKIT_DEPRECATED_FOR(webkit_website_data_manager_set_network_proxy_settings) void
 webkit_web_context_set_network_proxy_settings       (WebKitWebContext              *context,
                                                      WebKitNetworkProxyMode         proxy_mode,
                                                      WebKitNetworkProxySettings    *proxy_settings);
index 39f4e87..03d3186 100644 (file)
@@ -27,6 +27,7 @@
 #include <gio/gio.h>
 #include <wpe/WebKitCookieManager.h>
 #include <wpe/WebKitDefines.h>
+#include <wpe/WebKitNetworkProxySettings.h>
 #include <wpe/WebKitWebsiteData.h>
 
 G_BEGIN_DECLS
@@ -142,6 +143,11 @@ WEBKIT_API WebKitTLSErrorsPolicy
 webkit_website_data_manager_get_tls_errors_policy                     (WebKitWebsiteDataManager *manager);
 
 WEBKIT_API void
+webkit_website_data_manager_set_network_proxy_settings                (WebKitWebsiteDataManager *manager,
+                                                                       WebKitNetworkProxyMode    proxy_mode,
+                                                                       WebKitNetworkProxySettings *proxy_settings);
+
+WEBKIT_API void
 webkit_website_data_manager_fetch                                     (WebKitWebsiteDataManager *manager,
                                                                        WebKitWebsiteDataTypes    types,
                                                                        GCancellable             *cancellable,
index 8ba9226..a435953 100644 (file)
@@ -4,7 +4,6 @@
 WebKitWebContext
 WebKitCacheModel
 WebKitProcessModel
-WebKitNetworkProxyMode
 webkit_web_context_get_default
 webkit_web_context_new
 webkit_web_context_new_ephemeral
@@ -1408,6 +1407,7 @@ webkit_website_data_manager_set_persistent_credential_storage_enabled
 webkit_website_data_manager_get_persistent_credential_storage_enabled
 webkit_website_data_manager_set_tls_errors_policy
 webkit_website_data_manager_get_tls_errors_policy
+webkit_website_data_manager_set_network_proxy_settings
 webkit_website_data_manager_fetch
 webkit_website_data_manager_fetch_finish
 webkit_website_data_manager_remove
@@ -1470,6 +1470,7 @@ webkit_website_data_get_type
 <SECTION>
 <FILE>WebKitNetworkProxySettings</FILE>
 WebKitNetworkProxySettings
+WebKitNetworkProxyMode
 webkit_network_proxy_settings_new
 webkit_network_proxy_settings_copy
 webkit_network_proxy_settings_free
index d4ba180..9906b7d 100644 (file)
 #include "WebMediaSessionFocusManager.h"
 #endif
 
-#if USE(SOUP)
-#include <WebCore/SoupNetworkProxySettings.h>
-#endif
-
 #if PLATFORM(COCOA)
 OBJC_CLASS NSMutableDictionary;
 OBJC_CLASS NSObject;
@@ -296,7 +292,6 @@ public:
 
 #if USE(SOUP)
     void setInitialHTTPCookieAcceptPolicy(WebCore::HTTPCookieAcceptPolicy policy) { m_initialHTTPCookieAcceptPolicy = policy; }
-    void setNetworkProxySettings(const WebCore::SoupNetworkProxySettings&);
 #endif
     void setEnhancedAccessibility(bool);
     
@@ -682,7 +677,6 @@ private:
 
 #if USE(SOUP)
     WebCore::HTTPCookieAcceptPolicy m_initialHTTPCookieAcceptPolicy { WebCore::HTTPCookieAcceptPolicy::ExclusivelyFromMainDocumentDomain };
-    WebCore::SoupNetworkProxySettings m_networkProxySettings;
 #endif
 
 #if PLATFORM(MAC)
index 2ade720..e9deba4 100644 (file)
 #include <WebCore/CurlProxySettings.h>
 #endif
 
+#if USE(SOUP)
+#include <WebCore/SoupNetworkProxySettings.h>
+#endif
+
 namespace API {
 class HTTPCookieStore;
 }
@@ -261,6 +265,8 @@ public:
     bool persistentCredentialStorageEnabled() const { return m_persistentCredentialStorageEnabled && isPersistent(); }
     void setIgnoreTLSErrors(bool);
     bool ignoreTLSErrors() const { return m_ignoreTLSErrors; }
+    void setNetworkProxySettings(WebCore::SoupNetworkProxySettings&&);
+    const WebCore::SoupNetworkProxySettings& networkProxySettings() const { return m_networkProxySettings; }
 #endif
 
     static void allowWebsiteDataRecordsForAllOrigins();
@@ -398,6 +404,7 @@ private:
 #if USE(SOUP)
     bool m_persistentCredentialStorageEnabled { true };
     bool m_ignoreTLSErrors { true };
+    WebCore::SoupNetworkProxySettings m_networkProxySettings;
 #endif
 
     HashSet<WebCore::Cookie> m_pendingCookies;
index bdf66e2..c569760 100644 (file)
@@ -39,6 +39,7 @@ void WebsiteDataStore::platformSetNetworkParameters(WebsiteDataStoreParameters&
     auto& networkSessionParameters = parameters.networkSessionParameters;
     networkSessionParameters.persistentCredentialStorageEnabled = m_persistentCredentialStorageEnabled;
     networkSessionParameters.ignoreTLSErrors = m_ignoreTLSErrors;
+    networkSessionParameters.proxySettings = m_networkProxySettings;
 
     if (auto* processPool = processPoolForCookieStorageOperations())
         processPool->supplement<WebCookieManagerProxy>()->getCookiePersistentStorage(m_sessionID, networkSessionParameters.cookiePersistentStoragePath, networkSessionParameters.cookiePersistentStorageType);
@@ -67,4 +68,11 @@ void WebsiteDataStore::setIgnoreTLSErrors(bool ignoreTLSErrors)
         processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetIgnoreTLSErrors(m_sessionID, m_ignoreTLSErrors));
 }
 
+void WebsiteDataStore::setNetworkProxySettings(WebCore::SoupNetworkProxySettings&& settings)
+{
+    m_networkProxySettings = WTFMove(settings);
+    for (auto& processPool : processPools())
+        processPool->sendToNetworkingProcess(Messages::NetworkProcess::SetNetworkProxySettings(m_sessionID, m_networkProxySettings));
+}
+
 } // namespace WebKit
index be19796..f74f923 100644 (file)
@@ -96,7 +96,6 @@ void WebProcessPool::platformInitializeWebProcess(const WebProcessProxy& process
 #endif
 
     parameters.memoryCacheDisabled = m_memoryCacheDisabled || LegacyGlobalSettings::singleton().cacheModel() == CacheModel::DocumentViewer;
-    parameters.proxySettings = m_networkProxySettings;
 
     if (memoryPressureMonitorDisabled())
         parameters.shouldSuppressMemoryPressureHandler = true;
index f970df4..6b7c5b4 100644 (file)
@@ -42,19 +42,12 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
     if (m_websiteDataStore) {
         defaultSessionParameters.persistentCredentialStorageEnabled = m_websiteDataStore->persistentCredentialStorageEnabled();
         defaultSessionParameters.ignoreTLSErrors = m_websiteDataStore->ignoreTLSErrors();
+        defaultSessionParameters.proxySettings = m_websiteDataStore->networkProxySettings();
     }
 
     parameters.cookieAcceptPolicy = m_initialHTTPCookieAcceptPolicy;
     parameters.languages = userPreferredLanguages();
-    parameters.proxySettings = m_networkProxySettings;
     parameters.shouldEnableITPDatabase = true;
 }
 
-void WebProcessPool::setNetworkProxySettings(const WebCore::SoupNetworkProxySettings& settings)
-{
-    m_networkProxySettings = settings;
-    if (m_networkProcess)
-        m_networkProcess->send(Messages::NetworkProcess::SetNetworkProxySettings(m_networkProxySettings), 0);
-}
-
-}
+} // namespace WebKit
index 0dc22a3..898a5fb 100644 (file)
@@ -1,3 +1,15 @@
+2020-09-24  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK][WPE] Move proxy settings from WebKitContext to WebKitWebsiteDataManager
+        https://bugs.webkit.org/show_bug.cgi?id=216927
+
+        Reviewed by Alex Christensen.
+
+        Use the new API in tests.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
+        (testWebContextProxySettings):
+
 2020-09-24  Sergio Villar Senin  <svillar@igalia.com>
 
         [JHBUILD] Port jhbuild-wrapper to python3
index b082c5b..2f3a2b2 100644 (file)
@@ -671,7 +671,8 @@ static void testWebContextProxySettings(ProxyTest* test, gconstpointer)
     // Set default proxy URI to point to proxyServer. Requests to kServer should be received by proxyServer instead.
     GUniquePtr<char> proxyURI(soup_uri_to_string(test->m_proxyServer.baseURI(), FALSE));
     WebKitNetworkProxySettings* settings = webkit_network_proxy_settings_new(proxyURI.get(), nullptr);
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
+    auto* dataManager = webkit_web_context_get_website_data_manager(test->m_webContext.get());
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
     GUniquePtr<char> proxyServerPortAsString = test->proxyServerPortAsString();
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, proxyServerPortAsString.get());
@@ -711,14 +712,14 @@ static void testWebContextProxySettings(ProxyTest* test, gconstpointer)
     g_main_loop_run(test->m_mainLoop);
 
     // Remove the proxy. Requests to kServer should be received by kServer again.
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_NO_PROXY, nullptr);
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_NO_PROXY, nullptr);
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, serverPortAsString.get());
 
     // Use a default proxy uri, but ignoring requests to localhost.
     static const char* ignoreHosts[] = { "localhost", nullptr };
     settings = webkit_network_proxy_settings_new(proxyURI.get(), ignoreHosts);
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, proxyServerPortAsString.get());
     GUniquePtr<char> localhostEchoPortURI(g_strdup_printf("http://localhost:%s/echoPort", serverPortAsString.get()));
@@ -727,20 +728,20 @@ static void testWebContextProxySettings(ProxyTest* test, gconstpointer)
     webkit_network_proxy_settings_free(settings);
 
     // Remove the proxy again to ensure next test is not using any previous values.
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_NO_PROXY, nullptr);
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_NO_PROXY, nullptr);
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, serverPortAsString.get());
 
     // Use scheme specific proxy instead of the default.
     settings = webkit_network_proxy_settings_new(nullptr, nullptr);
     webkit_network_proxy_settings_add_proxy_for_scheme(settings, "http", proxyURI.get());
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_CUSTOM, settings);
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, proxyServerPortAsString.get());
     webkit_network_proxy_settings_free(settings);
 
     // Reset to use the default resolver.
-    webkit_web_context_set_network_proxy_settings(test->m_webContext.get(), WEBKIT_NETWORK_PROXY_MODE_DEFAULT, nullptr);
+    webkit_website_data_manager_set_network_proxy_settings(dataManager, WEBKIT_NETWORK_PROXY_MODE_DEFAULT, nullptr);
     mainResourceData = test->loadURIAndGetMainResourceData(kServer->getURIForPath("/echoPort").data());
     ASSERT_CMP_CSTRING(mainResourceData, ==, serverPortAsString.get());