Bug 1277090 - getElementAttribute() has to only return attributes. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 14 Dec 2016 22:26:34 +0100
changeset 454181 3a67c17fb82875606de5b307de99587437be8685
parent 454180 085ec0fa7b6f395b81001c42ce243ff5e8a77459
child 454182 511c121422e3f2f25ff9f5dc4c036838c50f2f57
push id39858
push userbmo:hskupin@gmail.com
push dateWed, 28 Dec 2016 13:42:34 +0000
bugs1277090
milestone53.0a1
Bug 1277090 - getElementAttribute() has to only return attributes. Formerly getElementAttribute() has returned a mix of attributes and properties. Since getElementProperty() has been added, there is no need anymore for getElementAttribute() to return conflated data. MozReview-Commit-ID: 29saWd9PsOX
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -64,18 +64,24 @@ class HTMLElement(object):
         """
         body = {"id": self.id, "name": name}
         return self.marionette._send_message("getElementAttribute", body, key="value")
 
     def get_property(self, name):
         """Returns the requested property, or None if the property is
         not set.
         """
-        body = {"id": self.id, "name": name}
-        return self.marionette._send_message("getElementProperty", body, key="value")
+        try:
+            body = {"id": self.id, "name": name}
+            return self.marionette._send_message("getElementProperty", body, key="value")
+        except errors.UnknownCommandException:
+            # Keep backward compatibility for code which uses get_attribute() to
+            # also retrieve element properties.
+            # Remove when Firefox 55 is stable.
+            return self.get_attribute(name)
 
     def click(self):
         self.marionette._send_message("clickElement", {"id": self.id})
 
     def tap(self, x=None, y=None):
         """Simulates a set of tap events on the element.
 
         :param x: X coordinate of tap event.  If not given, default to
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1837,17 +1837,18 @@ GeckoDriver.prototype.clickElement = fun
  */
 GeckoDriver.prototype.getElementAttribute = function*(cmd, resp) {
   let {id, name} = cmd.parameters;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
       let el = this.curBrowser.seenEls.get(id, {frame: win});
-      resp.body.value = atom.getElementAttribute(el, name, this.getCurrentWindow());
+
+      resp.body.value = el.getAttribute(name);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementAttribute(id, name);
       break;
   }
 };