Title: [234753] trunk/Source/WebDriver
Revision
234753
Author
carlo...@webkit.org
Date
2018-08-10 01:17:06 -0700 (Fri, 10 Aug 2018)

Log Message

[GTK][WPE] WebDriver: do not use default browser arguments when browser binary has been provided
https://bugs.webkit.org/show_bug.cgi?id=188465

Reviewed by Žan Doberšek.

We only want to use --automation when no options or no browser binary is provided, because we fallback to
MiniBrowser and we know it needs --automation flag.

* glib/SessionHostGlib.cpp:
(WebDriver::SessionHost::launchBrowser): Handle the case of browser arguments being std::nullopt.
* gtk/WebDriverServiceGtk.cpp:
(WebDriver::WebDriverService::platformParseCapabilities const): Initialize browser arguments to std:nullopt if
browser binary was provided.
* wpe/WebDriverServiceWPE.cpp:
(WebDriver::WebDriverService::platformParseCapabilities const): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebDriver/ChangeLog (234752 => 234753)


--- trunk/Source/WebDriver/ChangeLog	2018-08-10 07:57:00 UTC (rev 234752)
+++ trunk/Source/WebDriver/ChangeLog	2018-08-10 08:17:06 UTC (rev 234753)
@@ -1,3 +1,21 @@
+2018-08-10  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK][WPE] WebDriver: do not use default browser arguments when browser binary has been provided
+        https://bugs.webkit.org/show_bug.cgi?id=188465
+
+        Reviewed by Žan Doberšek.
+
+        We only want to use --automation when no options or no browser binary is provided, because we fallback to
+        MiniBrowser and we know it needs --automation flag.
+
+        * glib/SessionHostGlib.cpp:
+        (WebDriver::SessionHost::launchBrowser): Handle the case of browser arguments being std::nullopt.
+        * gtk/WebDriverServiceGtk.cpp:
+        (WebDriver::WebDriverService::platformParseCapabilities const): Initialize browser arguments to std:nullopt if
+        browser binary was provided.
+        * wpe/WebDriverServiceWPE.cpp:
+        (WebDriver::WebDriverService::platformParseCapabilities const): Ditto.
+
 2018-08-03  Ms2ger  <ms2...@igalia.com>
 
         Fix invalid optional access in WebDriver Session::createTopLevelBrowsingContext.

Modified: trunk/Source/WebDriver/glib/SessionHostGlib.cpp (234752 => 234753)


--- trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2018-08-10 07:57:00 UTC (rev 234752)
+++ trunk/Source/WebDriver/glib/SessionHostGlib.cpp	2018-08-10 08:17:06 UTC (rev 234753)
@@ -147,11 +147,11 @@
     g_subprocess_launcher_setenv(launcher.get(), "GTK_OVERLAY_SCROLLING", m_capabilities.useOverlayScrollbars.value() ? "1" : "0", TRUE);
 #endif
 
-    const auto& browserArguments = m_capabilities.browserArguments.value();
-    GUniquePtr<char*> args(g_new0(char*, browserArguments.size() + 2));
+    size_t browserArgumentsSize = m_capabilities.browserArguments ? m_capabilities.browserArguments->size() : 0;
+    GUniquePtr<char*> args(g_new0(char*, browserArgumentsSize + 2));
     args.get()[0] = g_strdup(m_capabilities.browserBinary.value().utf8().data());
-    for (unsigned i = 0; i < browserArguments.size(); ++i)
-        args.get()[i + 1] = g_strdup(browserArguments[i].utf8().data());
+    for (unsigned i = 0; i < browserArgumentsSize; ++i)
+        args.get()[i + 1] = g_strdup(m_capabilities.browserArguments.value()[i].utf8().data());
 
     GUniqueOutPtr<GError> error;
     m_browser = adoptGRef(g_subprocess_launcher_spawnv(launcher.get(), args.get(), &error.outPtr()));

Modified: trunk/Source/WebDriver/gtk/WebDriverServiceGtk.cpp (234752 => 234753)


--- trunk/Source/WebDriver/gtk/WebDriverServiceGtk.cpp	2018-08-10 07:57:00 UTC (rev 234752)
+++ trunk/Source/WebDriver/gtk/WebDriverServiceGtk.cpp	2018-08-10 08:17:06 UTC (rev 234753)
@@ -121,8 +121,10 @@
         return;
 
     String browserBinary;
-    if (browserOptions->getString("binary"_s, browserBinary))
+    if (browserOptions->getString("binary"_s, browserBinary)) {
         capabilities.browserBinary = browserBinary;
+        capabilities.browserArguments = std::nullopt;
+    }
 
     RefPtr<JSON::Array> browserArguments;
     if (browserOptions->getArray("args"_s, browserArguments) && browserArguments->length()) {

Modified: trunk/Source/WebDriver/wpe/WebDriverServiceWPE.cpp (234752 => 234753)


--- trunk/Source/WebDriver/wpe/WebDriverServiceWPE.cpp	2018-08-10 07:57:00 UTC (rev 234752)
+++ trunk/Source/WebDriver/wpe/WebDriverServiceWPE.cpp	2018-08-10 08:17:06 UTC (rev 234753)
@@ -88,8 +88,10 @@
         return;
 
     String browserBinary;
-    if (browserOptions->getString("binary"_s, browserBinary))
+    if (browserOptions->getString("binary"_s, browserBinary)) {
         capabilities.browserBinary = browserBinary;
+        capabilities.browserArguments = std::nullopt;
+    }
 
     RefPtr<JSON::Array> browserArguments;
     if (browserOptions->getArray("args"_s, browserArguments) && browserArguments->length()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to