Bug 1337743 - Make session and param checks safer against falsy values; r?whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 09 Feb 2017 18:15:26 +0000
changeset 551793 f45c706d4014b7ee3453861c4c8272db360fbe32
parent 551792 88f08a43ec9751ce80ac914cbcc34708c8b955d4
child 551794 a6889517f2174010336e20c0416c6598dddbd4e2
push id51152
push userbmo:ato@mozilla.com
push dateMon, 27 Mar 2017 12:36:48 +0000
reviewerswhimboo
bugs1337743
milestone55.0a1
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: