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
--- 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;