Bug 1337743 - Make session and param checks safer against falsy values; r=whimboo
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 09 Feb 2017 18:15:26 +0000
changeset 349804 c22e11b3b48f0de65fa674778c1f113c6fc4ccce
parent 349803 db7cea84f247dcf7693ab89a99515a999a1a60e7
child 349805 f076dfb2e7de2e67cdd0a01b74564d26282b36bd
push id39580
push useratolfsen@mozilla.com
push dateMon, 27 Mar 2017 13:57:21 +0000
treeherderautoland@5a5fd4594fd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1337743
milestone55.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 1337743 - Make session and param checks safer against falsy values; r=whimboo MozReview-Commit-ID: 8M79WmiRfkE
testing/marionette/client/marionette_driver/marionette.py
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -608,17 +608,17 @@ class Marionette(object):
         self.timeout = Timeouts(self)
 
     @property
     def profile_path(self):
         if self.instance and self.instance.profile:
             return self.instance.profile.profile
 
     def cleanup(self):
-        if self.session:
+        if self.session is not None:
             try:
                 self.delete_session()
             except (errors.MarionetteException, IOError):
                 # These exceptions get thrown if the Marionette server
                 # hit an exception/died or the connection died. We can
                 # do no further server-side cleanup in this case.
                 pass
         if self.instance:
@@ -708,17 +708,17 @@ class Marionette(object):
         """
 
         if not self.session_id and name != "newSession":
             raise errors.MarionetteException("Please start a session")
 
         try:
             if self.protocol < 3:
                 data = {"name": name}
-                if params:
+                if params is not None:
                     data["parameters"] = params
                 self.client.send(data)
                 msg = self.client.receive()
 
             else:
                 msg = self.client.request(name, params)
 
         except IOError: