Bug 1350887 - Bind sacrificial goat to ephemeral port; r=whimboo
Port 666 is in the protected port range and can not normally be bound
to unless the process is running with sudo permissions.
We can instead bind to port 0, which will give us a system-defined port
in the epemeral range.
MozReview-Commit-ID: Ld6BDMhtbck
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -282,17 +282,17 @@ MarionetteComponent.prototype.init = fun
if (!prefs.forceLocal) {
// See bug 800138. Because the first socket that opens with
// force-local=false fails, we open a dummy socket that will fail.
// keepWhenOffline=true so that it still work when offline (local).
// This allows the following attempt by Marionette to open a socket
// to succeed.
let insaneSacrificialGoat =
- new ServerSocket(666, Ci.nsIServerSocket.KeepWhenOffline, 4);
+ new ServerSocket(0, Ci.nsIServerSocket.KeepWhenOffline, 4);
insaneSacrificialGoat.asyncListen(this);
}
let s;
try {
Cu.import("chrome://marionette/content/server.js");
s = new server.TCPListener(prefs.port, prefs.forceLocal);
s.start();