Bug 1540078 - Let pywebsocket listen at localhost in mochitests r=ahal

Not specifying an explicit host causes pywebsocket to listen on the
default address, which may be 0.0.0.0. This triggers the firewall
on macOS, and causes the following prompt to be shown when mochitests
are run:

> Do you want the application "Python.app"
> to accept incoming network connections?

The dialog is a nuisance because it is always on top. Since denying
the access does not change the outcome of tests, it should be safe
to only listen on localhost.

Differential Revision: https://phabricator.services.mozilla.com/D25364

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Wu 2019-03-29 14:11:13 +00:00
parent 788d12712b
commit 420fe7e403

View File

@ -570,8 +570,8 @@ class WebSocketServer(object):
cmd = [sys.executable, script]
if self.debuggerInfo and self.debuggerInfo.interactive:
cmd += ['--interactive']
cmd += ['-p', str(self.port), '-w', self._scriptdir, '-l',
os.path.join(self._scriptdir, "websock.log"),
cmd += ['-H', '127.0.0.1', '-p', str(self.port), '-w', self._scriptdir,
'-l', os.path.join(self._scriptdir, "websock.log"),
'--log-level=debug', '--allow-handlers-outside-root-dir']
# start the process
self._process = mozprocess.ProcessHandler(cmd, cwd=SCRIPT_DIR)