Bug 1530979 - [marionette] Initialize Marionette when receiving the `marionette-startup-requested` notification. r=florian,automatedtester
authorHenrik Skupin <mail@hskupin.info>
Fri, 15 Mar 2019 12:51:11 +0000
changeset 522039 e79f9f619f035cd2e70058eec48b064ed5c4e1eb
parent 522038 3d6d57a8d3d90efbd48be3f82c40faf8e5cfc7dd
child 522040 e7f1772b47962f1038b749256929167416e5b06b
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, automatedtester
bugs1530979
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530979 - [marionette] Initialize Marionette when receiving the `marionette-startup-requested` notification. r=florian,automatedtester Differential Revision: https://phabricator.services.mozilla.com/D23489
testing/marionette/components/marionette.js
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -328,17 +328,16 @@ class MarionetteParentProcess {
           this.init(false);
         } else {
           this.uninit();
         }
         break;
 
       case "profile-after-change":
         Services.obs.addObserver(this, "command-line-startup");
-        Services.obs.addObserver(this, "sessionstore-windows-restored");
         Services.obs.addObserver(this, "toplevel-window-ready");
         Services.obs.addObserver(this, "marionette-startup-requested");
 
         for (let [pref, value] of EnvironmentPrefs.from(ENV_PRESERVE_PREFS)) {
           Preferences.set(pref, value);
         }
         break;
 
@@ -359,19 +358,22 @@ class MarionetteParentProcess {
           Services.obs.addObserver(this, "domwindowopened");
         }
 
         break;
 
       case "domwindowclosed":
         if (this.gfxWindow === null || subject === this.gfxWindow) {
           Services.obs.removeObserver(this, topic);
+          Services.obs.removeObserver(this, "toplevel-window-ready");
 
           Services.obs.addObserver(this, "xpcom-will-shutdown");
-          Services.obs.notifyObservers(this, "marionette-startup-requested");
+
+          this.finalUIStartup = true;
+          this.init();
         }
         break;
 
       case "domwindowopened":
         Services.obs.removeObserver(this, topic);
         this.suppressSafeModeDialog(subject);
         break;
 
@@ -383,45 +385,43 @@ class MarionetteParentProcess {
             let parserError = ev.target.querySelector("parsererror");
             log.fatal(parserError.textContent);
             this.uninit();
             Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
           }
         }, {once: true});
         break;
 
-      case "sessionstore-windows-restored":
+      case "marionette-startup-requested":
         Services.obs.removeObserver(this, topic);
-        Services.obs.removeObserver(this, "toplevel-window-ready");
 
         // When Firefox starts on Windows, an additional GFX sanity test
         // window may appear off-screen.  Marionette should wait for it
         // to close.
         for (let win of Services.wm.getEnumerator(null)) {
           if (win.document.documentURI == "chrome://gfxsanity/content/sanityparent.html") {
             this.gfxWindow = win;
             break;
           }
         }
 
         if (this.gfxWindow) {
           log.trace("GFX sanity window detected, waiting until it has been closed...");
           Services.obs.addObserver(this, "domwindowclosed");
         } else {
+          Services.obs.removeObserver(this, "toplevel-window-ready");
+
           Services.obs.addObserver(this, "xpcom-will-shutdown");
-          Services.obs.notifyObservers(this, "marionette-startup-requested");
+
+          this.finalUIStartup = true;
+          this.init();
         }
 
         break;
 
-      case "marionette-startup-requested":
-        this.finalUIStartup = true;
-        this.init();
-        break;
-
       case "xpcom-will-shutdown":
         Services.obs.removeObserver(this, "xpcom-will-shutdown");
         this.uninit();
         break;
     }
   }
 
   suppressSafeModeDialog(win) {