Bug 1546481 - Let wpt test servers listen at localhost r=jgraham
authorRob Wu <rob@robwu.nl>
Tue, 07 May 2019 09:04:58 +0000
changeset 531682 39ae355770620829620655b965de928567635aa6
parent 531681 bb9ad1e63c26115a367bbe6f92960fa9f8f72494
child 531683 802ffd2567cc78232b4b127d069a5d2deb552181
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1546481
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1546481 - Let wpt test servers listen at localhost r=jgraham When the host is omitted, a new socket will listen at any address, which triggers the following firewall warning: > Do you want the application "Python.app" > to accept incoming network connections? Since the default behavior without approval is to deny, it should be safe to limit this to local connections only. Doing so gets rid of the FIVE firewall prompts that appear when a wpt test is started, for each server (http, https, http2, ws, wss). While I'm at it, I've also fixed the port detection logic to not trigger the firewall prompt (it appears at `mach wpt-serve`). Differential Revision: https://phabricator.services.mozilla.com/D28541
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
testing/web-platform/tests/tools/wptserve/wptserve/utils.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -140,17 +140,16 @@ def env_extras(**kwargs):
 
 def env_options():
     # The server host is set to 127.0.0.1 as Firefox is configured (through the
     # network.dns.localDomains preference set below) to resolve the test
     # domains to localhost without relying on the network stack.
     #
     # https://github.com/web-platform-tests/wpt/pull/9480
     return {"server_host": "127.0.0.1",
-            "bind_address": False,
             "supports_debugger": True}
 
 
 def run_info_extras(**kwargs):
 
     def get_bool_pref(pref):
         for key, value in kwargs.get('extra_prefs', []):
             if pref == key:
--- a/testing/web-platform/tests/tools/wptserve/wptserve/utils.py
+++ b/testing/web-platform/tests/tools/wptserve/wptserve/utils.py
@@ -95,16 +95,17 @@ def is_bad_port(port):
         6666,  # irc (alternate)
         6667,  # irc (default)
         6668,  # irc (alternate)
         6669,  # irc (alternate)
         6697,  # irc+tls
     ]
 
 def get_port(host=''):
+    host = host or '127.0.0.1'
     port = 0
     while True:
         free_socket = _open_socket(host, 0)
         port = free_socket.getsockname()[1]
         free_socket.close()
         if not is_bad_port(port):
             break
     return port