Bug 1378209 - Add INFO log lines for how Marionette got started.
It is helpful to let the user know how Marionette get started. So
INFO log lines have to be added for the command line argument and
the environment variable.
This is especially helpful to get in case of missing observer
notifications, under which the server socket is not getting
created, and the client just hangs.
MozReview-Commit-ID: 4TEF33CDJKP
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -111,29 +111,33 @@ const prefs = {
Preferences.set(prefName, prefs[prefName]);
}
}
}
},
};
function MarionetteComponent() {
- this.enabled = env.exists(ENV_ENABLED);
this.running = false;
this.server = null;
// holds reference to ChromeWindow
// used to run GFX sanity tests on Windows
this.gfxWindow = null;
// indicates that all pending window checks have been completed
// and that we are ready to start the Marionette server
this.finalUIStartup = false;
this.logger = this.setupLogger(prefs.logLevel);
+
+ this.enabled = env.exists(ENV_ENABLED);
+ if (this.enabled) {
+ this.logger.info(`Enabled via ${ENV_ENABLED}`);
+ }
}
MarionetteComponent.prototype = {
classDescription: "Marionette component",
classID: MARIONETTE_CID,
contractID: MARIONETTE_CONTRACT_ID,
QueryInterface: XPCOMUtils.generateQI([
Ci.nsICommandLineHandler,
@@ -143,18 +147,19 @@ MarionetteComponent.prototype = {
{category: "command-line-handler", entry: "b-marionette"},
{category: "profile-after-change", service: true},
],
helpInfo: " --marionette Enable remote control server.\n",
};
// Handle -marionette flag
MarionetteComponent.prototype.handle = function(cmdLine) {
- if (cmdLine.handleFlag("marionette", false)) {
+ if (!this.enabled && cmdLine.handleFlag("marionette", false)) {
this.enabled = true;
+ this.logger.info("Enabled via --marionette");
}
};
MarionetteComponent.prototype.observe = function(subject, topic, data) {
switch (topic) {
case "command-line-startup":
Services.obs.removeObserver(this, topic);
this.handle(subject);