Bug 1451727 - [marionette] Update vendor specific commands to use custom prefixes. r=ato a=test-only
authorHenrik Skupin <mail@hskupin.info>
Thu, 05 Apr 2018 21:23:57 +0200
changeset 463170 3d457aab66d4f828ea7e521b34e294f3a93e9ae2
parent 463169 1bcba4cdfa8611951396c98250aaa31a947f332e
child 463171 0c798753bf0722e547644c323cd9bdc0e497a461
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1451727
milestone60.0
Bug 1451727 - [marionette] Update vendor specific commands to use custom prefixes. r=ato a=test-only All chrome context related commands have to use the "Marionette" prefix. For those commands which accidentally have been put under the "WebDriver" prefix a fallback to the old command is needed in the Marionette client. Also update related comments about possible removal dates. MozReview-Commit-ID: IZLL6pineSO
testing/marionette/client/marionette_driver/addons.py
testing/marionette/client/marionette_driver/localization.py
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
--- a/testing/marionette/client/marionette_driver/addons.py
+++ b/testing/marionette/client/marionette_driver/addons.py
@@ -44,17 +44,18 @@ class Addons(object):
 
         :returns: The addon ID string of the newly installed addon.
 
         :raises: :exc:`AddonInstallException`
 
         """
         body = {"path": path, "temporary": temp}
         try:
-            return self._mn._send_message("addon:install", body, key="value")
+            return self._mn._send_message("Addon:Install",
+                                          body, key="value")
         except errors.UnknownException as e:
             raise AddonInstallException(e)
 
     def uninstall(self, addon_id):
         """Uninstall a Firefox addon.
 
         If the addon is restartless, it will be uninstalled right away.
         Otherwise a restart using :func:`~marionette_driver.marionette.Marionette.restart`
@@ -63,10 +64,10 @@ class Addons(object):
         If the call to uninstall is resulting in a `ScriptTimeoutException`,
         an invalid ID is likely being passed in. Unfortunately due to
         AddonManager's implementation, it's hard to retrieve this error from
         Python.
 
         :param addon_id: The addon ID string to uninstall.
 
         """
-        body = {"id": addon_id}
-        self._mn._send_message("addon:uninstall", body)
+        self._mn._send_message("Addon:Uninstall",
+                               {"id": addon_id})
--- a/testing/marionette/client/marionette_driver/localization.py
+++ b/testing/marionette/client/marionette_driver/localization.py
@@ -33,24 +33,24 @@ class L10n(object):
 
         :param dtd_urls: List of .dtd URLs which will be used to search for the entity.
         :param entity_id: ID of the entity to retrieve the localized string for.
 
         :returns: The localized string for the requested entity.
         :raises: :exc:`NoSuchElementException`
         """
         body = {"urls": dtd_urls, "id": entity_id}
-        return self._marionette._send_message("localization:l10n:localizeEntity",
+        return self._marionette._send_message("L10n:LocalizeEntity",
                                               body, key="value")
 
     def localize_property(self, properties_urls, property_id):
         """Retrieve the localized string for the specified property id.
 
         :param properties_urls: List of .properties URLs which will be used to
                                 search for the property.
         :param property_id: ID of the property to retrieve the localized string for.
 
         :returns: The localized string for the requested property.
         :raises: :exc:`NoSuchElementException`
         """
         body = {"urls": properties_urls, "id": property_id}
-        return self._marionette._send_message("localization:l10n:localizeProperty",
+        return self._marionette._send_message("L10n:LocalizeProperty",
                                               body, key="value")
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -474,17 +474,22 @@ class Actions(object):
         """
         self.action_chain.append(['keyUp', key_code])
         return self
 
     def perform(self):
         """Sends the action chain built so far to the server side for
         execution and clears the current chain of actions."""
         body = {"chain": self.action_chain, "nextId": self.current_id}
-        self.current_id = self.marionette._send_message("actionChain", body, key="value")
+        try:
+            self.current_id = self.marionette._send_message("Marionette:ActionChain",
+                                                            body, key="value")
+        except errors.UnknownCommandException:
+            self.current_id = self.marionette._send_message("actionChain",
+                                                            body, key="value")
         self.action_chain = []
         return self
 
 
 class MultiActions(object):
     '''
     A MultiActions object represents a sequence of actions that may be
     performed at the same time. Its intent is to allow the simulation
@@ -519,17 +524,20 @@ class MultiActions(object):
         self.multi_actions.append(action.action_chain)
         if len(action.action_chain) > self.max_length:
             self.max_length = len(action.action_chain)
         return self
 
     def perform(self):
         """Perform all the actions added to this object."""
         body = {"value": self.multi_actions, "max_length": self.max_length}
-        self.marionette._send_message("multiAction", body)
+        try:
+            self.marionette._send_message("Marionette:MultiAction", body)
+        except errors.UnknownCommandException:
+            self.marionette._send_message("multiAction", body)
 
 
 class Alert(object):
     """A class for interacting with alerts.
 
     ::
 
         Alert(marionette).accept()
@@ -1383,18 +1391,19 @@ class Marionette(object):
 
         Returns an opaque server-assigned identifier to this window
         that uniquely identifies it within this Marionette instance.
         This can be used to switch to this window at a later point.
 
         :returns: unique window handle
         :rtype: string
         """
-        self.chrome_window = self._send_message(
-            "getCurrentChromeWindowHandle", key="value")
+        self.chrome_window = self._send_message("WebDriver:GetChromeWindowHandle",
+                                                key="value")
+
         return self.chrome_window
 
     def get_window_position(self):
         """Get the current window's position.
 
         :returns: a dictionary with x and y
         """
         warnings.warn("get_window_position() has been deprecated, please use get_window_rect()",
@@ -1462,17 +1471,17 @@ class Marionette(object):
     def chrome_window_handles(self):
         """Get a list of currently open chrome windows.
 
         Each window handle is assigned by the server, and the list of
         strings returned does not have a guaranteed ordering.
 
         :returns: Unordered list of unique chrome window handles as strings
         """
-        return self._send_message("getChromeWindowHandles")
+        return self._send_message("WebDriver:GetChromeWindowHandles")
 
     @property
     def page_source(self):
         """A string representation of the DOM."""
         return self._send_message("WebDriver:GetPageSource",
                                   key="value")
 
     def close(self):
@@ -1484,17 +1493,17 @@ class Marionette(object):
         return self._send_message("WebDriver:CloseWindow")
 
     def close_chrome_window(self):
         """Close the currently selected chrome window, ending the session
         if it's the last window open.
 
         :returns: Unordered list of remaining unique chrome window handles as strings
         """
-        return self._send_message("closeChromeWindow")
+        return self._send_message("WebDriver:CloseChromeWindow")
 
     def set_context(self, context):
         """Sets the context that Marionette commands are running in.
 
         :param context: Context, may be one of the class properties
             `CONTEXT_CHROME` or `CONTEXT_CONTENT`.
 
         Usage example::
@@ -1628,17 +1637,21 @@ class Marionette(object):
 
     def get_window_type(self):
         """Gets the windowtype attribute of the window Marionette is
         currently acting on.
 
         This command only makes sense in a chrome context. You might use this
         method to distinguish a browser window from an editor window.
         """
-        return self._send_message("getWindowType", key="value")
+        try:
+            return self._send_message("Marionette:GetWindowType",
+                                      key="value")
+        except errors.UnknownCommandException:
+            return self._send_message("getWindowType", key="value")
 
     def navigate(self, url):
         """Navigate to given `url`.
 
         Navigates the current top-level browsing context's content
         frame to the given URL and waits for the document to load or
         the session's page timeout duration to elapse before returning.
 
@@ -2047,34 +2060,41 @@ class Marionette(object):
     @property
     def orientation(self):
         """Get the current browser orientation.
 
         Will return one of the valid primary orientation values
         portrait-primary, landscape-primary, portrait-secondary, or
         landscape-secondary.
         """
-        return self._send_message("getScreenOrientation", key="value")
+        try:
+            return self._send_message("Marionette:GetScreenOrientation",
+                                      key="value")
+        except errors.UnknownCommandException:
+            return self._send_message("getScreenOrientation", key="value")
 
     def set_orientation(self, orientation):
         """Set the current browser orientation.
 
         The supplied orientation should be given as one of the valid
         orientation values.  If the orientation is unknown, an error
         will be raised.
 
         Valid orientations are "portrait" and "landscape", which fall
         back to "portrait-primary" and "landscape-primary"
         respectively, and "portrait-secondary" as well as
         "landscape-secondary".
 
         :param orientation: The orientation to lock the screen in.
         """
         body = {"orientation": orientation}
-        self._send_message("setScreenOrientation", body)
+        try:
+            self._send_message("Marionette:SetScreenOrientation", body)
+        except errors.UnknownCommandException:
+            self._send_message("setScreenOrientation", body)
 
     @property
     def window_size(self):
         """Get the current browser window size.
 
         Will return the current browser window size in pixels. Refers to
         window outerWidth and outerHeight values, which include scroll bars,
         title bars, etc.
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -3492,37 +3492,56 @@ GeckoDriver.prototype.teardownReftest = 
   }
 
   this._reftest.abort();
   this._reftest = null;
 };
 
 GeckoDriver.prototype.commands = {
   // Marionette service
+  "Marionette:AcceptConnections": GeckoDriver.prototype.acceptConnections,
+  "Marionette:GetContext": GeckoDriver.prototype.getContext,
+  "Marionette:GetScreenOrientation": GeckoDriver.prototype.getScreenOrientation,
+  "Marionette:GetWindowType": GeckoDriver.prototype.getWindowType,
+  "Marionette:Quit": GeckoDriver.prototype.quit,
   "Marionette:SetContext": GeckoDriver.prototype.setContext,
-  "setContext": GeckoDriver.prototype.setContext,  // deprecated, remove in Firefox 60
-  "Marionette:GetContext": GeckoDriver.prototype.getContext,
+  "Marionette:SetScreenOrientation": GeckoDriver.prototype.setScreenOrientation,
+  // Bug 1354578 - Remove legacy action commands
+  "Marionette:ActionChain": GeckoDriver.prototype.actionChain,
+  "Marionette:MultiAction": GeckoDriver.prototype.multiAction,
+  "Marionette:SingleTap": GeckoDriver.prototype.singleTap,
+  // deprecated Marionette commands, remove in Firefox 63
+  "actionChain": GeckoDriver.prototype.actionChain,
+  "acceptConnections": GeckoDriver.prototype.acceptConnections,
+  "closeChromeWindow": GeckoDriver.prototype.closeChromeWindow,
+  "getChromeWindowHandles": GeckoDriver.prototype.getChromeWindowHandles,
   "getContext": GeckoDriver.prototype.getContext,
-  "Marionette:AcceptConnections": GeckoDriver.prototype.acceptConnections,
-  "acceptConnections": GeckoDriver.prototype.acceptConnections,  // deprecated, remove in Firefox 60
-  "Marionette:Quit": GeckoDriver.prototype.quit,
-  "quit": GeckoDriver.prototype.quit,  // deprecated, remove in Firefox 60
-  "quitApplication": GeckoDriver.prototype.quit,  // deprecated, remove in Firefox 60
+  "getCurrentChromeWindowHandle": GeckoDriver.prototype.getChromeWindowHandle,
+  "getScreenOrientation": GeckoDriver.prototype.getScreenOrientation,
+  "getWindowType": GeckoDriver.prototype.getWindowType,
+  "multiAction": GeckoDriver.prototype.multiAction,
+  "quit": GeckoDriver.prototype.quit,
+  "quitApplication": GeckoDriver.prototype.quit,
+  "setContext": GeckoDriver.prototype.setContext,
+  "setScreenOrientation": GeckoDriver.prototype.setScreenOrientation,
+  "singleTap": GeckoDriver.prototype.singleTap,
 
   // Addon service
   "Addon:Install": GeckoDriver.prototype.installAddon,
-  "addon:install": GeckoDriver.prototype.installAddon,  // deprecated, remove in Firefox 60
   "Addon:Uninstall": GeckoDriver.prototype.uninstallAddon,
-  "addon:uninstall": GeckoDriver.prototype.uninstallAddon,  // deprecated, remove in Firefox 60
+  // deprecated Addon commands, remove in Firefox 63
+  "addon:install": GeckoDriver.prototype.installAddon,
+  "addon:uninstall": GeckoDriver.prototype.uninstallAddon,
 
   // L10n service
   "L10n:LocalizeEntity": GeckoDriver.prototype.localizeEntity,
-  "localization:l10n:localizeEntity": GeckoDriver.prototype.localizeEntity,  // deprecated, remove in Firefox 60
   "L10n:LocalizeProperty": GeckoDriver.prototype.localizeProperty,
-  "localization:l10n:localizeProperty": GeckoDriver.prototype.localizeProperty,  // deprecated, remove in Firefox 60
+  // deprecated L10n commands, remove in Firefox 63
+  "localization:l10n:localizeEntity": GeckoDriver.prototype.localizeEntity,
+  "localization:l10n:localizeProperty": GeckoDriver.prototype.localizeProperty,
 
   // Reftest service
   "reftest:setup": GeckoDriver.prototype.setupReftest,
   "reftest:run": GeckoDriver.prototype.runReftest,
   "reftest:teardown": GeckoDriver.prototype.teardownReftest,
 
   // WebDriver service
   "WebDriver:AcceptAlert": GeckoDriver.prototype.acceptDialog,
@@ -3555,105 +3574,92 @@ GeckoDriver.prototype.commands = {
   "WebDriver:GetCurrentURL": GeckoDriver.prototype.getCurrentUrl,
   "WebDriver:GetElementAttribute": GeckoDriver.prototype.getElementAttribute,
   "WebDriver:GetElementCSSValue": GeckoDriver.prototype.getElementValueOfCssProperty,
   "WebDriver:GetElementProperty": GeckoDriver.prototype.getElementProperty,
   "WebDriver:GetElementRect": GeckoDriver.prototype.getElementRect,
   "WebDriver:GetElementTagName": GeckoDriver.prototype.getElementTagName,
   "WebDriver:GetElementText": GeckoDriver.prototype.getElementText,
   "WebDriver:GetPageSource": GeckoDriver.prototype.getPageSource,
-  "WebDriver:GetScreenOrientation": GeckoDriver.prototype.getScreenOrientation,
   "WebDriver:GetTimeouts": GeckoDriver.prototype.getTimeouts,
   "WebDriver:GetTitle": GeckoDriver.prototype.getTitle,
   "WebDriver:GetWindowHandle": GeckoDriver.prototype.getWindowHandle,
   "WebDriver:GetWindowHandles": GeckoDriver.prototype.getWindowHandles,
   "WebDriver:GetWindowRect": GeckoDriver.prototype.getWindowRect,
-  "WebDriver:GetWindowType": GeckoDriver.prototype.getWindowType,
   "WebDriver:IsElementDisplayed": GeckoDriver.prototype.isElementDisplayed,
   "WebDriver:IsElementEnabled": GeckoDriver.prototype.isElementEnabled,
   "WebDriver:IsElementSelected": GeckoDriver.prototype.isElementSelected,
   "WebDriver:MinimizeWindow": GeckoDriver.prototype.minimizeWindow,
   "WebDriver:MaximizeWindow": GeckoDriver.prototype.maximizeWindow,
   "WebDriver:Navigate": GeckoDriver.prototype.get,
   "WebDriver:NewSession": GeckoDriver.prototype.newSession,
   "WebDriver:PerformActions": GeckoDriver.prototype.performActions,
   "WebDriver:Refresh":  GeckoDriver.prototype.refresh,
   "WebDriver:ReleaseActions": GeckoDriver.prototype.releaseActions,
   "WebDriver:SendAlertText": GeckoDriver.prototype.sendKeysToDialog,
-  "WebDriver:SetScreenOrientation": GeckoDriver.prototype.setScreenOrientation,
   "WebDriver:SetTimeouts": GeckoDriver.prototype.setTimeouts,
   "WebDriver:SetWindowRect": GeckoDriver.prototype.setWindowRect,
   "WebDriver:SwitchToFrame": GeckoDriver.prototype.switchToFrame,
   "WebDriver:SwitchToParentFrame": GeckoDriver.prototype.switchToParentFrame,
   "WebDriver:SwitchToShadowRoot": GeckoDriver.prototype.switchToShadowRoot,
   "WebDriver:SwitchToWindow": GeckoDriver.prototype.switchToWindow,
   "WebDriver:TakeScreenshot": GeckoDriver.prototype.takeScreenshot,
 
-  // deprecated WebDriver commands, remove in Firefox 60
+  // deprecated WebDriver commands, remove in Firefox 63
   "acceptDialog": GeckoDriver.prototype.acceptDialog,
-  "actionChain": GeckoDriver.prototype.actionChain,
   "addCookie": GeckoDriver.prototype.addCookie,
   "clearElement": GeckoDriver.prototype.clearElement,
   "clickElement": GeckoDriver.prototype.clickElement,
-  "closeChromeWindow": GeckoDriver.prototype.closeChromeWindow,
   "close": GeckoDriver.prototype.close,
   "deleteAllCookies": GeckoDriver.prototype.deleteAllCookies,
   "deleteCookie": GeckoDriver.prototype.deleteCookie,
   "deleteSession": GeckoDriver.prototype.deleteSession,
   "dismissDialog": GeckoDriver.prototype.dismissDialog,
   "executeAsyncScript": GeckoDriver.prototype.executeAsyncScript,
   "executeScript": GeckoDriver.prototype.executeScript,
   "findElement": GeckoDriver.prototype.findElement,
   "findElements": GeckoDriver.prototype.findElements,
   "fullscreen": GeckoDriver.prototype.fullscreenWindow,
   "getActiveElement": GeckoDriver.prototype.getActiveElement,
   "getActiveFrame": GeckoDriver.prototype.getActiveFrame,
-  "getChromeWindowHandle": GeckoDriver.prototype.getChromeWindowHandle,
-  "getChromeWindowHandles": GeckoDriver.prototype.getChromeWindowHandles,
   "getCookies": GeckoDriver.prototype.getCookies,
-  "getCurrentChromeWindowHandle": GeckoDriver.prototype.getChromeWindowHandle,
   "getCurrentUrl": GeckoDriver.prototype.getCurrentUrl,
   "getElementAttribute": GeckoDriver.prototype.getElementAttribute,
   "getElementProperty": GeckoDriver.prototype.getElementProperty,
   "getElementRect": GeckoDriver.prototype.getElementRect,
   "getElementTagName": GeckoDriver.prototype.getElementTagName,
   "getElementText": GeckoDriver.prototype.getElementText,
   "getElementValueOfCssProperty": GeckoDriver.prototype.getElementValueOfCssProperty,
   "get": GeckoDriver.prototype.get,
   "getPageSource": GeckoDriver.prototype.getPageSource,
-  "getScreenOrientation": GeckoDriver.prototype.getScreenOrientation,
   "getSessionCapabilities": GeckoDriver.prototype.getSessionCapabilities,
   "getTextFromDialog": GeckoDriver.prototype.getTextFromDialog,
   "getTimeouts": GeckoDriver.prototype.getTimeouts,
   "getTitle": GeckoDriver.prototype.getTitle,
   "getWindowHandle": GeckoDriver.prototype.getWindowHandle,
   "getWindowHandles": GeckoDriver.prototype.getWindowHandles,
   "getWindowPosition": GeckoDriver.prototype.getWindowRect, // redirect for compatibility
   "getWindowRect": GeckoDriver.prototype.getWindowRect,
   "getWindowSize": GeckoDriver.prototype.getWindowRect, // redirect for compatibility
-  "getWindowType": GeckoDriver.prototype.getWindowType,
   "goBack": GeckoDriver.prototype.goBack,
   "goForward": GeckoDriver.prototype.goForward,
   "isElementDisplayed": GeckoDriver.prototype.isElementDisplayed,
   "isElementEnabled": GeckoDriver.prototype.isElementEnabled,
   "isElementSelected": GeckoDriver.prototype.isElementSelected,
   "maximizeWindow": GeckoDriver.prototype.maximizeWindow,
-  "multiAction": GeckoDriver.prototype.multiAction,
   "newSession": GeckoDriver.prototype.newSession,
   "performActions": GeckoDriver.prototype.performActions,
   "refresh":  GeckoDriver.prototype.refresh,
   "releaseActions": GeckoDriver.prototype.releaseActions,
   "sendKeysToDialog": GeckoDriver.prototype.sendKeysToDialog,
   "sendKeysToElement": GeckoDriver.prototype.sendKeysToElement,
-  "setScreenOrientation": GeckoDriver.prototype.setScreenOrientation,
   "setTimeouts": GeckoDriver.prototype.setTimeouts,
   "setWindowPosition": GeckoDriver.prototype.setWindowRect, // redirect for compatibility
   "setWindowRect": GeckoDriver.prototype.setWindowRect,
   "setWindowSize": GeckoDriver.prototype.setWindowRect, // redirect for compatibility
-  "singleTap": GeckoDriver.prototype.singleTap,
   "switchToFrame": GeckoDriver.prototype.switchToFrame,
   "switchToParentFrame": GeckoDriver.prototype.switchToParentFrame,
   "switchToShadowRoot": GeckoDriver.prototype.switchToShadowRoot,
   "switchToWindow": GeckoDriver.prototype.switchToWindow,
   "takeScreenshot": GeckoDriver.prototype.takeScreenshot,
 };
 
 function getOuterWindowId(win) {