Bug 1378209 - Add INFO log lines for how Marionette got started. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 05 Jul 2017 10:33:23 +0200
changeset 604083 d29f69e0e39c5004695f68bea2033758eacce6dc
parent 604013 0893f6685e154aaa3252ed091abb16a2feb2806d
child 604084 78a08f89c7a6d505266d02ca5e211e6fe227168f
push id66948
push userbmo:hskupin@gmail.com
push dateWed, 05 Jul 2017 08:40:39 +0000
bugs1378209
milestone56.0a1
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
testing/marionette/components/marionette.js
--- 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);