Bug 1342162 - Make timeout API in client backwards compatible; r=whimboo
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 23 Mar 2017 16:22:34 +0000
changeset 397856 a6380012133b6353bdd4f2708ab1aee697684cf8
parent 397855 84948ee2d8ff4e7358585dc6937ef0213e1eba1e
child 397857 9025c14f11790c4b19b67cdc3c836c2578b080ad
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1342162
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 1342162 - Make timeout API in client backwards compatible; r=whimboo This makes the session timeout duration configuration API backwards compatible with earlier Firefoxen. As Marionette changes to accept pageLoad, we must still continue to allow "page load" as a key for as long as the Marionette Python client is used for Firefox upgrade tests. MozReview-Commit-ID: Ln4D3bY2d7f
testing/marionette/client/marionette_driver/timeout.py
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -31,17 +31,20 @@ class Timeouts(object):
         ms = sec * 1000
         try:
             self._marionette._send_message("setTimeouts", {name: ms})
         except errors.UnknownCommandException:
             # remove when 55 is stable
             self._marionette._send_message("timeouts", {"type": name, "ms": ms})
 
     def _get(self, name):
-        ms = self._marionette._send_message("getTimeouts", key=name)
+        ts = self._marionette._send_message("getTimeouts")
+        if name not in ts:
+            raise KeyError()
+        ms = ts[name]
         return ms / 1000
 
     @property
     def script(self):
         """Get the session's script timeout.  This specifies the time
         to wait for injected scripts to finished before interrupting
         them. It is by default 30 seconds.
 
@@ -58,25 +61,33 @@ class Timeouts(object):
 
     @property
     def page_load(self):
         """Get the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.  It is by default 5
         minutes (or 300 seconds).
 
         """
-        return self._get("pageLoad")
+        # remove fallback when Firefox 56 is stable
+        try:
+            return self._get("pageLoad")
+        except KeyError:
+            return self._get("page load")
 
     @page_load.setter
     def page_load(self, sec):
         """Set the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.
 
         """
-        self._set("pageLoad", sec)
+        # remove fallback when Firefox 56 is stable
+        try:
+            self._set("pageLoad", sec)
+        except errors.InvalidArgumentException:
+            return self._set("page load", sec)
 
     @property
     def implicit(self):
         """Get the session's implicit wait timeout.  This specifies the
         time to wait for the implicit element location strategy when
         retrieving elements.  It is by default disabled (0 seconds).
 
         """