Title: [252323] trunk
Revision
252323
Author
carlo...@webkit.org
Date
2019-11-11 07:16:16 -0800 (Mon, 11 Nov 2019)

Log Message

WebDriver: implement proxy support
https://bugs.webkit.org/show_bug.cgi?id=180408

Reviewed by Carlos Alberto Lopez Perez.

Source/_javascript_Core:

Add optional Proxy struct to session capabilities.

* inspector/remote/RemoteInspector.h:
* inspector/remote/glib/RemoteInspectorServer.cpp:
(Inspector::processSessionCapabilities):

Source/WebDriver:

Handle proxy object in capabilities.

* Capabilities.h: Add Proxy struct.
* WebDriverService.cpp:
(WebDriver::deserializeProxy): Deserialize the proxy from capabilities.
(WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy.
(WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid.
(WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform.
(WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a
deserialized proxy.
* WebDriverService.h:
* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser.
* glib/WebDriverServiceGLib.cpp:
(WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac".

Source/WebKit:

* UIProcess/API/glib/WebKitAutomationSession.cpp:
(parseProxyCapabilities): Parse the proxy settings from capabilities.
(webkitAutomationSessionCreate): Set the proxy settings received from capabilities.

WebDriverTests:

Unskip the tests that are now passing.

* TestExpectations.json:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (252322 => 252323)


--- trunk/Source/_javascript_Core/ChangeLog	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-11-11 15:16:16 UTC (rev 252323)
@@ -1,3 +1,16 @@
+2019-11-11  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: implement proxy support
+        https://bugs.webkit.org/show_bug.cgi?id=180408
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Add optional Proxy struct to session capabilities.
+
+        * inspector/remote/RemoteInspector.h:
+        * inspector/remote/glib/RemoteInspectorServer.cpp:
+        (Inspector::processSessionCapabilities):
+
 2019-11-09  Tadeu Zagallo  <tzaga...@apple.com>
 
         [WebAssembly] Improve bytecode dumping

Modified: trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h (252322 => 252323)


--- trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/_javascript_Core/inspector/remote/RemoteInspector.h	2019-11-11 15:16:16 UTC (rev 252323)
@@ -92,6 +92,15 @@
             bool acceptInsecureCertificates { false };
 #if USE(GLIB)
             Vector<std::pair<String, String>> certificates;
+            struct Proxy {
+                String type;
+                Optional<String> ftpURL;
+                Optional<String> httpURL;
+                Optional<String> httpsURL;
+                Optional<String> socksURL;
+                Vector<String> ignoreAddressList;
+            };
+            Optional<Proxy> proxy;
 #endif
 #if PLATFORM(COCOA)
             Optional<bool> allowInsecureMediaCapture;

Modified: trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorServer.cpp (252322 => 252323)


--- trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorServer.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/_javascript_Core/inspector/remote/glib/RemoteInspectorServer.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -105,6 +105,37 @@
             capabilities.certificates.uncheckedAppend({ String::fromUTF8(host), String::fromUTF8(certificateFile) });
     }
 
+    if (GRefPtr<GVariant> proxy = g_variant_lookup_value(sessionCapabilities, "proxy", G_VARIANT_TYPE("a{sv}"))) {
+        capabilities.proxy = RemoteInspector::Client::SessionCapabilities::Proxy();
+
+        const char* proxyType;
+        g_variant_lookup(proxy.get(), "type", "&s", &proxyType);
+        capabilities.proxy->type = String::fromUTF8(proxyType);
+
+        const char* ftpURL;
+        if (g_variant_lookup(proxy.get(), "ftpURL", "&s", &ftpURL))
+            capabilities.proxy->ftpURL = String::fromUTF8(ftpURL);
+
+        const char* httpURL;
+        if (g_variant_lookup(proxy.get(), "httpURL", "&s", &httpURL))
+            capabilities.proxy->httpURL = String::fromUTF8(httpURL);
+
+        const char* httpsURL;
+        if (g_variant_lookup(proxy.get(), "httpsURL", "&s", &httpsURL))
+            capabilities.proxy->httpsURL = String::fromUTF8(httpsURL);
+
+        const char* socksURL;
+        if (g_variant_lookup(proxy.get(), "socksURL", "&s", &socksURL))
+            capabilities.proxy->socksURL = String::fromUTF8(socksURL);
+
+        if (GRefPtr<GVariant> ignoreAddressList = g_variant_lookup_value(proxy.get(), "ignoreAddressList", G_VARIANT_TYPE("as"))) {
+            gsize ignoreAddressListLength;
+            GUniquePtr<char> ignoreAddressArray(reinterpret_cast<char*>(g_variant_get_strv(ignoreAddressList.get(), &ignoreAddressListLength)));
+            for (unsigned i = 0; i < ignoreAddressListLength; ++i)
+                capabilities.proxy->ignoreAddressList.append(String::fromUTF8(reinterpret_cast<char**>(ignoreAddressArray.get())[i]));
+        }
+    }
+
     return capabilities;
 }
 const GDBusInterfaceVTable RemoteInspectorServer::s_interfaceVTable = {

Modified: trunk/Source/WebDriver/Capabilities.h (252322 => 252323)


--- trunk/Source/WebDriver/Capabilities.h	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/Capabilities.h	2019-11-11 15:16:16 UTC (rev 252323)
@@ -28,6 +28,7 @@
 #include <utility>
 #include <wtf/Forward.h>
 #include <wtf/Seconds.h>
+#include <wtf/URL.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -53,6 +54,17 @@
     Ignore
 };
 
+struct Proxy {
+    String type;
+    Optional<String> autoconfigURL;
+    Optional<URL> ftpURL;
+    Optional<URL> httpURL;
+    Optional<URL> httpsURL;
+    Optional<URL> socksURL;
+    Optional<uint8_t> socksVersion;
+    Vector<String> ignoreAddressList;
+};
+
 struct Capabilities {
     Optional<String> browserName;
     Optional<String> browserVersion;
@@ -62,6 +74,7 @@
     Optional<Timeouts> timeouts;
     Optional<PageLoadStrategy> pageLoadStrategy;
     Optional<UnhandledPromptBehavior> unhandledPromptBehavior;
+    Optional<Proxy> proxy;
 #if PLATFORM(GTK) || PLATFORM(WPE)
     Optional<String> browserBinary;
     Optional<Vector<String>> browserArguments;

Modified: trunk/Source/WebDriver/ChangeLog (252322 => 252323)


--- trunk/Source/WebDriver/ChangeLog	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/ChangeLog	2019-11-11 15:16:16 UTC (rev 252323)
@@ -1,3 +1,26 @@
+2019-11-11  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: implement proxy support
+        https://bugs.webkit.org/show_bug.cgi?id=180408
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Handle proxy object in capabilities.
+
+        * Capabilities.h: Add Proxy struct.
+        * WebDriverService.cpp:
+        (WebDriver::deserializeProxy): Deserialize the proxy from capabilities.
+        (WebDriver::WebDriverService::parseCapabilities const): Get the deserialized proxy.
+        (WebDriver::WebDriverService::validatedCapabilities const): Ensure proxy object is valid.
+        (WebDriver::WebDriverService::matchCapabilities const): Check proxy type is supported by the platform.
+        (WebDriver::WebDriverService::createSession): Only set an empty proxy object in capabilities if we don't have a
+        deserialized proxy.
+        * WebDriverService.h:
+        * glib/SessionHostGlib.cpp:
+        (WebDriver::SessionHost::buildSessionCapabilities const): Send the proxy settings to the browser.
+        * glib/WebDriverServiceGLib.cpp:
+        (WebDriver::WebDriverService::platformSupportProxyType const): Return false if proxy type is "pac".
+
 2019-11-08  Carlos Garcia Campos  <cgar...@igalia.com>
 
         WebDriver: implement get page source command

Modified: trunk/Source/WebDriver/WebDriverService.cpp (252322 => 252323)


--- trunk/Source/WebDriver/WebDriverService.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/WebDriverService.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -346,6 +346,94 @@
     return timeouts;
 }
 
+static Optional<Proxy> deserializeProxy(JSON::Object& proxyObject)
+{
+    // ยง7.1 Proxy.
+    // https://w3c.github.io/webdriver/#proxy
+    Proxy proxy;
+    if (!proxyObject.getString("proxyType"_s, proxy.type))
+        return WTF::nullopt;
+
+    if (proxy.type == "direct" || proxy.type == "autodetect" || proxy.type == "system")
+        return proxy;
+
+    if (proxy.type == "pac") {
+        String autoconfigURL;
+        if (!proxyObject.getString("proxyAutoconfigUrl"_s, autoconfigURL))
+            return WTF::nullopt;
+
+        proxy.autoconfigURL = autoconfigURL;
+        return proxy;
+    }
+
+    if (proxy.type == "manual") {
+        RefPtr<JSON::Value> value;
+        if (proxyObject.getValue("ftpProxy"_s, value)) {
+            String ftpProxy;
+            if (!value->asString(ftpProxy))
+                return WTF::nullopt;
+
+            proxy.ftpURL = URL({ }, makeString("ftp://", ftpProxy));
+            if (!proxy.ftpURL->isValid())
+                return WTF::nullopt;
+        }
+        if (proxyObject.getValue("httpProxy"_s, value)) {
+            String httpProxy;
+            if (!value->asString(httpProxy))
+                return WTF::nullopt;
+
+            proxy.httpURL = URL({ }, makeString("http://", httpProxy));
+            if (!proxy.httpURL->isValid())
+                return WTF::nullopt;
+        }
+        if (proxyObject.getValue("sslProxy"_s, value)) {
+            String sslProxy;
+            if (!value->asString(sslProxy))
+                return WTF::nullopt;
+
+            proxy.httpsURL = URL({ }, makeString("https://", sslProxy));
+            if (!proxy.httpsURL->isValid())
+                return WTF::nullopt;
+        }
+        if (proxyObject.getValue("socksProxy", value)) {
+            String socksProxy;
+            if (!value->asString(socksProxy))
+                return WTF::nullopt;
+
+            proxy.socksURL = URL({ }, makeString("socks://", socksProxy));
+            if (!proxy.socksURL->isValid())
+                return WTF::nullopt;
+
+            RefPtr<JSON::Value> socksVersionValue;
+            if (!proxyObject.getValue("socksVersion", socksVersionValue))
+                return WTF::nullopt;
+
+            auto socksVersion = unsignedValue(*socksVersionValue);
+            if (!socksVersion || socksVersion.value() > 255)
+                return WTF::nullopt;
+            proxy.socksVersion = socksVersion.value();
+        }
+        if (proxyObject.getValue("noProxy"_s, value)) {
+            RefPtr<JSON::Array> noProxy;
+            if (!value->asArray(noProxy))
+                return WTF::nullopt;
+
+            auto noProxyLength = noProxy->length();
+            for (unsigned i = 0; i < noProxyLength; ++i) {
+                RefPtr<JSON::Value> addressValue = noProxy->get(i);
+                String address;
+                if (!addressValue->asString(address))
+                    return WTF::nullopt;
+                proxy.ignoreAddressList.append(WTFMove(address));
+            }
+        }
+
+        return proxy;
+    }
+
+    return WTF::nullopt;
+}
+
 static Optional<PageLoadStrategy> deserializePageLoadStrategy(const String& pageLoadStrategy)
 {
     if (pageLoadStrategy == "none")
@@ -390,6 +478,9 @@
     String platformName;
     if (matchedCapabilities.getString("platformName"_s, platformName))
         capabilities.platformName = platformName;
+    RefPtr<JSON::Object> proxy;
+    if (matchedCapabilities.getObject("proxy"_s, proxy))
+        capabilities.proxy = deserializeProxy(*proxy);
     RefPtr<JSON::Object> timeouts;
     if (matchedCapabilities.getObject("timeouts"_s, timeouts))
         capabilities.timeouts = deserializeTimeouts(*timeouts);
@@ -443,7 +534,10 @@
                 return nullptr;
             result->setString(it->key, pageLoadStrategy);
         } else if (it->key == "proxy") {
-            // FIXME: implement proxy support.
+            RefPtr<JSON::Object> proxy;
+            if (!it->value->asObject(proxy) || !deserializeProxy(*proxy))
+                return nullptr;
+            result->setValue(it->key, RefPtr<JSON::Value>(it->value));
         } else if (it->key == "timeouts") {
             RefPtr<JSON::Object> timeouts;
             if (!it->value->asObject(timeouts) || !deserializeTimeouts(*timeouts))
@@ -523,7 +617,12 @@
             if (acceptInsecureCerts && !platformCapabilities.acceptInsecureCerts.value())
                 return nullptr;
         } else if (it->key == "proxy") {
-            // FIXME: implement proxy support.
+            RefPtr<JSON::Object> proxy;
+            it->value->asObject(proxy);
+            String proxyType;
+            proxy->getString("proxyType"_s, proxyType);
+            if (!platformSupportProxyType(proxyType))
+                return nullptr;
         } else if (!platformMatchCapability(it->key, it->value))
             return nullptr;
         matchedCapabilities->setValue(it->key, RefPtr<JSON::Value>(it->value));
@@ -729,8 +828,8 @@
                 capabilitiesObject->setString("pageLoadStrategy"_s, "eager");
                 break;
             }
-            // FIXME: implement proxy support.
-            capabilitiesObject->setObject("proxy"_s, JSON::Object::create());
+            if (!capabilities.proxy)
+                capabilitiesObject->setObject("proxy"_s, JSON::Object::create());
             RefPtr<JSON::Object> timeoutsObject = JSON::Object::create();
             timeoutsObject->setInteger("script"_s, m_session->scriptTimeout().millisecondsAs<int>());
             timeoutsObject->setInteger("pageLoad"_s, m_session->pageLoadTimeout().millisecondsAs<int>());

Modified: trunk/Source/WebDriver/WebDriverService.h (252322 => 252323)


--- trunk/Source/WebDriver/WebDriverService.h	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/WebDriverService.h	2019-11-11 15:16:16 UTC (rev 252323)
@@ -123,6 +123,7 @@
     RefPtr<JSON::Object> matchCapabilities(const JSON::Object&) const;
     bool platformValidateCapability(const String&, const RefPtr<JSON::Value>&) const;
     bool platformMatchCapability(const String&, const RefPtr<JSON::Value>&) const;
+    bool platformSupportProxyType(const String&) const;
     void parseCapabilities(const JSON::Object& desiredCapabilities, Capabilities&) const;
     void platformParseCapabilities(const JSON::Object& desiredCapabilities, Capabilities&) const;
     void connectToBrowser(Vector<Capabilities>&&, Function<void (CommandResult&&)>&&);

Modified: trunk/Source/WebDriver/glib/SessionHostGlib.cpp (252322 => 252323)


--- trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -267,7 +267,7 @@
 
 bool SessionHost::buildSessionCapabilities(GVariantBuilder* builder) const
 {
-    if (!m_capabilities.acceptInsecureCerts && !m_capabilities.certificates)
+    if (!m_capabilities.acceptInsecureCerts && !m_capabilities.certificates && !m_capabilities.proxy)
         return false;
 
     g_variant_builder_init(builder, G_VARIANT_TYPE("a{sv}"));
@@ -284,6 +284,44 @@
         g_variant_builder_add(builder, "{sv}", "certificates", g_variant_builder_end(&arrayBuilder));
     }
 
+    if (m_capabilities.proxy) {
+        GVariantBuilder dictBuilder;
+        g_variant_builder_init(&dictBuilder, G_VARIANT_TYPE("a{sv}"));
+        g_variant_builder_add(&dictBuilder, "{sv}", "type", g_variant_new_string(m_capabilities.proxy->type.utf8().data()));
+        if (m_capabilities.proxy->ftpURL)
+            g_variant_builder_add(&dictBuilder, "{sv}", "ftpURL", g_variant_new_string(m_capabilities.proxy->ftpURL->string().utf8().data()));
+        if (m_capabilities.proxy->httpURL)
+            g_variant_builder_add(&dictBuilder, "{sv}", "httpURL", g_variant_new_string(m_capabilities.proxy->httpURL->string().utf8().data()));
+        if (m_capabilities.proxy->httpsURL)
+            g_variant_builder_add(&dictBuilder, "{sv}", "httpsURL", g_variant_new_string(m_capabilities.proxy->httpsURL->string().utf8().data()));
+        if (m_capabilities.proxy->socksURL) {
+            URL socksURL = m_capabilities.proxy->socksURL.value();
+            ASSERT(m_capabilities.proxy->socksVersion);
+            switch (m_capabilities.proxy->socksVersion.value()) {
+            case 4:
+                if (URL::hostIsIPAddress(socksURL.host()))
+                    socksURL.setProtocol("socks4");
+                else
+                    socksURL.setProtocol("socks4a");
+                break;
+            case 5:
+                socksURL.setProtocol("socks5");
+                break;
+            default:
+                break;
+            }
+            g_variant_builder_add(&dictBuilder, "{sv}", "socksURL", g_variant_new_string(socksURL.string().utf8().data()));
+        }
+        if (!m_capabilities.proxy->ignoreAddressList.isEmpty()) {
+            GUniquePtr<char*> ignoreAddressList(static_cast<char**>(g_new0(char*, m_capabilities.proxy->ignoreAddressList.size() + 1)));
+            unsigned i = 0;
+            for (const auto& ignoreAddress : m_capabilities.proxy->ignoreAddressList)
+                ignoreAddressList.get()[i++] = g_strdup(ignoreAddress.utf8().data());
+            g_variant_builder_add(&dictBuilder, "{sv}", "ignoreAddressList", g_variant_new_strv(ignoreAddressList.get(), -1));
+        }
+        g_variant_builder_add(builder, "{sv}", "proxy", g_variant_builder_end(&dictBuilder));
+    }
+
     return true;
 }
 

Modified: trunk/Source/WebDriver/glib/WebDriverServiceGLib.cpp (252322 => 252323)


--- trunk/Source/WebDriver/glib/WebDriverServiceGLib.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/glib/WebDriverServiceGLib.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -73,4 +73,9 @@
         || (proposedMajor == requiredMajor && proposedMinor == requiredMinor && proposedMicro >= requiredMicro);
 }
 
+bool WebDriverService::platformSupportProxyType(const String& proxyType) const
+{
+    return proxyType != "pac";
+}
+
 } // namespace WebDriver

Modified: trunk/Source/WebDriver/win/WebDriverServiceWin.cpp (252322 => 252323)


--- trunk/Source/WebDriver/win/WebDriverServiceWin.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebDriver/win/WebDriverServiceWin.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -58,4 +58,9 @@
 {
 }
 
+bool WebDriverService::platformSupportProxyType(const String&) const
+{
+    return false;
+}
+
 } // namespace WebDriver

Modified: trunk/Source/WebKit/ChangeLog (252322 => 252323)


--- trunk/Source/WebKit/ChangeLog	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebKit/ChangeLog	2019-11-11 15:16:16 UTC (rev 252323)
@@ -1,3 +1,14 @@
+2019-11-11  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: implement proxy support
+        https://bugs.webkit.org/show_bug.cgi?id=180408
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * UIProcess/API/glib/WebKitAutomationSession.cpp:
+        (parseProxyCapabilities): Parse the proxy settings from capabilities.
+        (webkitAutomationSessionCreate): Set the proxy settings received from capabilities.
+
 2019-11-10  David Kilzer  <ddkil...@apple.com>
 
         StorageManagerSet.m_storageAreas should use weak pointers to StorageArea

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp (252322 => 252323)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp	2019-11-11 15:16:16 UTC (rev 252323)
@@ -292,6 +292,35 @@
 }
 
 #if ENABLE(REMOTE_INSPECTOR)
+static WebKitNetworkProxyMode parseProxyCapabilities(const Inspector::RemoteInspector::Client::SessionCapabilities::Proxy& proxy, WebKitNetworkProxySettings** settings)
+{
+    if (proxy.type == "system")
+        return WEBKIT_NETWORK_PROXY_MODE_DEFAULT;
+
+    if (proxy.type == "direct")
+        return WEBKIT_NETWORK_PROXY_MODE_NO_PROXY;
+
+    if (!proxy.ignoreAddressList.isEmpty()) {
+        GUniquePtr<char*> ignoreAddressList(static_cast<char**>(g_new0(char*, proxy.ignoreAddressList.size() + 1)));
+        unsigned i = 0;
+        for (const auto& ignoreAddress : proxy.ignoreAddressList)
+            ignoreAddressList.get()[i++] = g_strdup(ignoreAddress.utf8().data());
+        *settings = webkit_network_proxy_settings_new(nullptr, ignoreAddressList.get());
+    } else
+        *settings = webkit_network_proxy_settings_new(nullptr, nullptr);
+
+    if (proxy.ftpURL)
+        webkit_network_proxy_settings_add_proxy_for_scheme(*settings, "ftp", proxy.ftpURL->utf8().data());
+    if (proxy.httpURL)
+        webkit_network_proxy_settings_add_proxy_for_scheme(*settings, "http", proxy.httpURL->utf8().data());
+    if (proxy.httpsURL)
+        webkit_network_proxy_settings_add_proxy_for_scheme(*settings, "https", proxy.httpsURL->utf8().data());
+    if (proxy.socksURL)
+        webkit_network_proxy_settings_add_proxy_for_scheme(*settings, "socks", proxy.socksURL->utf8().data());
+
+    return WEBKIT_NETWORK_PROXY_MODE_CUSTOM;
+}
+
 WebKitAutomationSession* webkitAutomationSessionCreate(WebKitWebContext* webContext, const char* sessionID, const Inspector::RemoteInspector::Client::SessionCapabilities& capabilities)
 {
     auto* session = WEBKIT_AUTOMATION_SESSION(g_object_new(WEBKIT_TYPE_AUTOMATION_SESSION, "id", sessionID, nullptr));
@@ -303,6 +332,13 @@
         if (tlsCertificate)
             webkit_web_context_allow_tls_certificate_for_host(webContext, tlsCertificate.get(), certificate.first.utf8().data());
     }
+    if (capabilities.proxy) {
+        WebKitNetworkProxySettings* proxySettings = nullptr;
+        auto proxyMode = parseProxyCapabilities(*capabilities.proxy, &proxySettings);
+        webkit_web_context_set_network_proxy_settings(webContext, proxyMode, proxySettings);
+        if (proxySettings)
+            webkit_network_proxy_settings_free(proxySettings);
+    }
     return session;
 }
 #endif

Modified: trunk/WebDriverTests/ChangeLog (252322 => 252323)


--- trunk/WebDriverTests/ChangeLog	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/WebDriverTests/ChangeLog	2019-11-11 15:16:16 UTC (rev 252323)
@@ -1,3 +1,14 @@
+2019-11-11  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        WebDriver: implement proxy support
+        https://bugs.webkit.org/show_bug.cgi?id=180408
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Unskip the tests that are now passing.
+
+        * TestExpectations.json:
+
 2019-11-08  Carlos Garcia Campos  <cgar...@igalia.com>
 
         WebDriver: implement get page source command

Modified: trunk/WebDriverTests/TestExpectations.json (252322 => 252323)


--- trunk/WebDriverTests/TestExpectations.json	2019-11-11 15:13:37 UTC (rev 252322)
+++ trunk/WebDriverTests/TestExpectations.json	2019-11-11 15:16:16 UTC (rev 252323)
@@ -763,118 +763,6 @@
             }
         }
     },
-    "imported/w3c/webdriver/tests/new_session/invalid_capabilities.py": {
-        "subtests": {
-            "test_invalid_values[proxy-1-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-1-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value28-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value28-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-{}-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-{}-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value30-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value30-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value31-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value31-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value32-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value32-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value33-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value33-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value34-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value34-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value35-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value35-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value36-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value36-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value37-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value37-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value38-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value38-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value39-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value39-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value40-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value40-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value41-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value41-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value42-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value42-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value43-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value43-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value44-<lambda>0]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            },
-            "test_invalid_values[proxy-value44-<lambda>1]": {
-                "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/180408"}}
-            }
-        }
-    },
     "imported/w3c/webdriver/tests/new_session/default_values.py": {
         "subtests": {
             "test_valid_but_unmatchable_key": {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to