Bug 1404277 - Retrieve namespaceURI as property and not attribute. draft
authorHenrik Skupin <mail@hskupin.info>
Fri, 29 Sep 2017 12:54:03 +0200
changeset 672579 2cbb2be93c0201c05329e26c3e9c1bed7b1ff23f
parent 671089 35fbf14b96a633c3f66ea13c1a163a3f3a4219b9
child 733833 7d9ecfbadef23a89486f4d7ed3885a4ca27959cf
push id82279
push userbmo:hskupin@gmail.com
push dateFri, 29 Sep 2017 10:54:40 +0000
bugs1404277
milestone58.0a1
Bug 1404277 - Retrieve namespaceURI as property and not attribute. With newer Selenium atoms which do not conflate attributes and properties, the retrieval via getElementAttribute will fail. By retrieving it directly as property will fix it. MozReview-Commit-ID: CFy3JZDeUWq
testing/marionette/element.js
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -20,17 +20,19 @@ const {
 } = Cu.import("chrome://marionette/content/error.js", {});
 Cu.import("chrome://marionette/content/wait.js");
 
 const logger = Log.repository.getLogger("Marionette");
 
 this.EXPORTED_SYMBOLS = ["element"];
 
 const DOCUMENT_POSITION_DISCONNECTED = 1;
+
 const XMLNS = "http://www.w3.org/1999/xhtml";
+const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 const uuidGen = Cc["@mozilla.org/uuid-generator;1"]
     .getService(Ci.nsIUUIDGenerator);
 
 /**
  * This module provides shared functionality for dealing with DOM-
  * and web elements in Marionette.
  *
@@ -941,18 +943,17 @@ element.isKeyboardInteractable = functio
  */
 element.scrollIntoView = function(el) {
   if (el.scrollIntoView) {
     el.scrollIntoView({block: "end", inline: "nearest", behavior: "instant"});
   }
 };
 
 element.isXULElement = function(el) {
-  let ns = atom.getElementAttribute(el, "namespaceURI");
-  return ns.indexOf("there.is.only.xul") >= 0;
+  return el.namespaceURI === XULNS;
 };
 
 const boolEls = {
   audio: ["autoplay", "controls", "loop", "muted"],
   button: ["autofocus", "disabled", "formnovalidate"],
   details: ["open"],
   dialog: ["open"],
   fieldset: ["disabled"],