Bug 1428795 - Set MOZ_MARIONETTE in component. r=automatedtester

Setting the MOZ_MARIONETTE environment variable is not a task that
naturally belongs to the TCP listener.  This patch moves it to the
Marionette XPCOM component.

MozReview-Commit-ID: 7896Sv91wFy

--HG--
extra : rebase_source : a43335d289c2568f60be3ecc5a9491b2bee27fe9
This commit is contained in:
Andreas Tolfsen 2018-02-26 20:34:54 +00:00
parent 9a121d83f5
commit 00a171e75d
2 changed files with 1 additions and 9 deletions

View File

@ -552,6 +552,7 @@ class MarionetteMainProcess {
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
}
env.set(ENV_ENABLED, "1");
Services.obs.notifyObservers(this, NOTIFY_RUNNING, true);
log.info(`Listening on port ${this.server.port}`);
});

View File

@ -14,7 +14,6 @@ const ServerSocket = CC(
ChromeUtils.import("resource://gre/modules/Log.jsm");
ChromeUtils.import("resource://gre/modules/Preferences.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("chrome://marionette/content/assert.js");
const {GeckoDriver} = ChromeUtils.import("chrome://marionette/content/driver.js", {});
@ -30,9 +29,6 @@ const {
} = ChromeUtils.import("chrome://marionette/content/message.js", {});
const {DebuggerTransport} = ChromeUtils.import("chrome://marionette/content/transport.js", {});
XPCOMUtils.defineLazyServiceGetter(
this, "env", "@mozilla.org/process/environment;1", "nsIEnvironment");
const logger = Log.repository.getLogger("Marionette");
const {KeepWhenOffline, LoopbackOnly} = Ci.nsIServerSocket;
@ -44,8 +40,6 @@ this.server = {};
const PROTOCOL_VERSION = 3;
const ENV_ENABLED = "MOZ_MARIONETTE";
const PREF_CONTENT_LISTENER = "marionette.contentListener";
const PREF_PORT = "marionette.port";
@ -115,10 +109,7 @@ server.TCPListener = class {
// Start socket server and listening for connection attempts
this.acceptConnections = true;
Preferences.set(PREF_PORT, this.port);
env.set(ENV_ENABLED, "1");
this.alive = true;
}