Bug 1321775 - Better handling for client property in Marionette class. r=ato
authorHenrik Skupin <mail@hskupin.info>
Fri, 02 Dec 2016 18:22:00 +0100
changeset 325142 23eb207c40d8949ca2f6db414c1376955fff4d80
parent 325141 821b0005c39b7dae3e9f08857371bc013e334cf5
child 325143 6d2d2fdac6c7668cc7d33a79d5b05b420f721824
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersato
bugs1321775
milestone53.0a1
Bug 1321775 - Better handling for client property in Marionette class. r=ato MozReview-Commit-ID: KNe3DIrnBlh
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -565,16 +565,17 @@ class Marionette(object):
         :param app: Type of ``instance_class`` to use for managing app
             instance. See ``marionette_driver.geckoinstance``.
         :param instance_args: Arguments to pass to ``instance_class``.
 
         """
         self.host = host
         self.port = self.local_port = int(port)
         self.bin = bin
+        self.client = None
         self.instance = None
         self.session = None
         self.session_id = None
         self.process_id = None
         self.profile = None
         self.window = None
         self.chrome_window = None
         self.baseurl = baseurl
@@ -1303,17 +1304,19 @@ class Marionette(object):
                 self._send_message("deleteSession")
         finally:
             if reset_session_id:
                 self.session_id = None
             self.session = None
             self.process_id = None
             self.profile = None
             self.window = None
-            self.client.close()
+
+            if self.client is not None:
+                self.client.close()
 
     @property
     def session_capabilities(self):
         """A JSON dictionary representing the capabilities of the
         current session.
 
         """
         return self.session