Bug 1282570 - In case of in-app restarts Marionette has to update mozprocess for the new process id. r?automatedtester draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 07 Jul 2016 15:58:50 +0200
changeset 385083 6a7d2f37cefd557c82d04a2b5b6d3b223ecaa9f8
parent 384778 09221c72fcb03a7c2b4ab27c75304eae3247e3d1
child 524846 4fdd9347a0dec11f260dc37d4dd724569230af39
push id22422
push userbmo:hskupin@gmail.com
push dateThu, 07 Jul 2016 17:31:57 +0000
reviewersautomatedtester
bugs1282570
milestone50.0a1
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