Bug 1282570 - In case of in-app restarts Marionette has to update mozprocess for the new process id. r=automatedtester
authorHenrik Skupin <mail@hskupin.info>
Thu, 07 Jul 2016 15:58:50 +0200
changeset 304099 72b76303de91b1b5f4f17e68a0fc25ad52d7af18
parent 304098 d4733f9ab04ec376f071ba95fdadae2d070cb1dc
child 304100 d75db8a749e7572134b73dcb0f935009a3c722d2
push id30412
push usercbook@mozilla.com
push dateFri, 08 Jul 2016 09:56:17 +0000
treeherdermozilla-central@be4699647551 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1282570
milestone50.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 1282570 - In case of in-app restarts Marionette has to update mozprocess for the new process id. r=automatedtester MozReview-Commit-ID: 51ccek1M5cw
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/client/requirements.txt
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -675,17 +675,17 @@ class Marionette(object):
                     data["parameters"] = params
                 self.client.send(data)
                 msg = self.client.receive()
 
             else:
                 msg = self.client.request(name, params)
 
         except IOError:
-            if self.instance and not hasattr(self.instance, 'detached'):
+            if self.instance:
                 # If we've launched the binary we've connected to, wait
                 # for it to shut down.
                 returncode = self.instance.runner.wait(timeout=self.DEFAULT_STARTUP_TIMEOUT)
                 raise IOError("process died with returncode %s" % returncode)
             raise
 
         except socket.timeout:
             self.session = None
@@ -1033,26 +1033,30 @@ class Marionette(object):
             # Values here correspond to constants in nsIAppStartup.
             # See http://mzl.la/1X0JZsC
             restart_flags = [
                 "eForceQuit",
                 "eRestart",
             ]
             self._send_message("quitApplication", {"flags": restart_flags})
             self.client.close()
-            # The instance is restarting itself; we will no longer be able to
-            # track it by pid, so mark it as 'detached'.
-            self.instance.detached = True
         else:
             self.delete_session()
             self.instance.restart(clean=clean)
+
         self.raise_for_port(self.wait_for_port())
         self.start_session(session_id=self.session_id)
         self._reset_timeouts()
 
+        if in_app:
+            # In some cases Firefox restarts itself by spawning into a new process group.
+            # As long as mozprocess cannot track that behavior (bug 1284864) we assist by
+            # informing about the new process id.
+            self.instance.runner.process_handler.check_for_detached(self.session['processId'])
+
     def absolute_url(self, relative_url):
         '''
         Returns an absolute url for files served from Marionette's www directory.
 
         :param relative_url: The url of a static file, relative to Marionette's www directory.
         '''
         return "%s%s" % (self.baseurl, relative_url)
 
--- a/testing/marionette/client/requirements.txt
+++ b/testing/marionette/client/requirements.txt
@@ -1,1 +1,1 @@
-mozrunner >= 6.9
+mozrunner >= 6.12