Bug 1462040 - Force geckodriver to always use IPv4 to connect to Marionette. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 16 May 2018 21:12:21 +0200
changeset 795911 52fc3b7f2704e35d3f250094b7335d648ba348ed
parent 795546 380cf87c1ee3966dd94499942b73085754dc4824
push id110114
push userbmo:hskupin@gmail.com
push dateWed, 16 May 2018 19:13:43 +0000
bugs1462040
milestone62.0a1
Bug 1462040 - Force geckodriver to always use IPv4 to connect to Marionette. Marionette uses nsIServerSocket which only allows to create a IPv4 listener. On systems where IPv6 has precedence geckodriver will automatically use the IPv6 address for `localhost` and will fail to connect to Marionette. As such we should force geckodriver to connect to "127.0.0.1". MozReview-Commit-ID: Dg1n6yYIi2N
testing/geckodriver/src/marionette.rs
--- a/testing/geckodriver/src/marionette.rs
+++ b/testing/geckodriver/src/marionette.rs
@@ -49,17 +49,19 @@ use webdriver::common::{Date, ELEMENT_KE
 use webdriver::error::{ErrorStatus, WebDriverError, WebDriverResult};
 use webdriver::server::{WebDriverHandler, Session};
 use webdriver::httpapi::{WebDriverExtensionRoute};
 
 use capabilities::{FirefoxCapabilities, FirefoxOptions};
 use logging;
 use prefs;
 
-const DEFAULT_HOST: &'static str = "localhost";
+// Bind host to IPv4 only because Marionette only listens on that interface
+const DEFAULT_HOST: &'static str = "127.0.0.1";
+
 const CHROME_ELEMENT_KEY: &'static str = "chromeelement-9fc5-4b51-a3c8-01716eedeb04";
 const LEGACY_ELEMENT_KEY: &'static str = "ELEMENT";
 
 pub fn extension_routes() -> Vec<(Method, &'static str, GeckoExtensionRoute)> {
     return vec![(Method::Get, "/session/{sessionId}/moz/context", GeckoExtensionRoute::GetContext),
              (Method::Post, "/session/{sessionId}/moz/context", GeckoExtensionRoute::SetContext),
              (Method::Post,
               "/session/{sessionId}/moz/xbl/{elementId}/anonymous_children",