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 464376 e79f9f619f03
parent 464375 3d6d57a8d3d9
child 464377 e7f1772b4796
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [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) {