Bug 1169290 - Handle -marionette flag in observe function. r?maja_zf draft
authorAndreas Tolfsen <ato@sny.no>
Sat, 27 Jan 2018 18:53:02 +0000
changeset 753894 b55b7c94dd2ff47819577da324beb4b03ebfc521
parent 753893 57776fa5e3a44a70d8b35586320d31d3f34769d4
child 753895 e37d3479cd09c0f3128183fc1c0a71fb547caca3
push id98715
push userbmo:ato@sny.no
push dateMon, 12 Feb 2018 16:37:16 +0000
reviewersmaja_zf
bugs1169290
milestone60.0a1
Bug 1169290 - Handle -marionette flag in observe function. r?maja_zf All the other notifications are handled in the observe function, and it doesn't really make sense as a top-level function on the MarionetteComponent class. MozReview-Commit-ID: 79xWM5SA4vq
testing/marionette/components/marionette.js
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -146,33 +146,22 @@ class MarionetteComponent {
 
     // indicates that all pending window checks have been completed
     // and that we are ready to start the Marionette server
     this.finalUIStartup = false;
 
     log.level = prefs.logLevel;
 
     this.enabled = env.exists(ENV_ENABLED);
-    if (this.enabled) {
-      log.info(`Enabled via ${ENV_ENABLED}`);
-    }
   }
 
   get running() {
     return this.server && this.server.alive;
   }
 
-  // Handle -marionette flag
-  handle(cmdLine) {
-    if (!this.enabled && cmdLine.handleFlag("marionette", false)) {
-      this.enabled = true;
-      log.debug("Enabled via flag");
-    }
-  }
-
   observe(subject, topic) {
     log.debug(`Received observer notification ${topic}`);
 
     switch (topic) {
       case "profile-after-change":
         Services.obs.addObserver(this, "command-line-startup");
         Services.obs.addObserver(this, "sessionstore-windows-restored");
 
@@ -180,17 +169,20 @@ class MarionetteComponent {
         break;
 
       // In safe mode the command line handlers are getting parsed after the
       // safe mode dialog has been closed. To allow Marionette to start
       // earlier, use the CLI startup observer notification for
       // special-cased handlers, which gets fired before the dialog appears.
       case "command-line-startup":
         Services.obs.removeObserver(this, topic);
-        this.handle(subject);
+
+        if (!this.enabled && subject.handleFlag("marionette", false)) {
+          this.enabled = true;
+        }
 
         // We want to suppress the modal dialog that's shown
         // when starting up in safe-mode to enable testing.
         if (this.enabled && Services.appinfo.inSafeMode) {
           Services.obs.addObserver(this, "domwindowopened");
         }
 
         break;