Commit cb2ec4bb authored by Andreas Tolfsen's avatar Andreas Tolfsen
Browse files

Bug 1250102 - Correct exported symbol from testing/marionette/element.js; r=automatedtester

MozReview-Commit-ID: 9naIfpy9HPD

--HG--
extra : rebase_source : dc6b96137ed6c378772477cc36687a1655028ae3
parent d7988942
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ GeckoDriver.prototype.listeningPromise = function() {
GeckoDriver.prototype.newSession = function*(cmd, resp) {
  this.sessionId = cmd.parameters.sessionId ||
      cmd.parameters.session_id ||
      elements.generateUUID();
      element.generateUUID();

  this.newSessionCommandId = cmd.id;
  this.setSessionCapabilities(cmd.parameters.capabilities);
+14 −14
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ Cu.import("chrome://marionette/content/error.js");
 */

this.EXPORTED_SYMBOLS = [
  "elements",
  "element",
  "ElementManager",
  "CLASS_NAME",
  "SELECTOR",
@@ -85,14 +85,14 @@ ElementManager.prototype = {
  * @return string
  *        Returns the server-assigned reference ID
  */
  addToKnownElements: function EM_addToKnownElements(element) {
  addToKnownElements: function EM_addToKnownElements(el) {
    for (let i in this.seenItems) {
      let foundEl = null;
      try {
        foundEl = this.seenItems[i].get();
      } catch (e) {}
      if (foundEl) {
        if (XPCNativeWrapper(foundEl) == XPCNativeWrapper(element)) {
        if (XPCNativeWrapper(foundEl) == XPCNativeWrapper(el)) {
          return i;
        }
      } else {
@@ -100,8 +100,8 @@ ElementManager.prototype = {
        delete this.seenItems[i];
      }
    }
    let id = elements.generateUUID();
    this.seenItems[id] = Cu.getWeakReference(element);
    let id = element.generateUUID();
    this.seenItems[id] = Cu.getWeakReference(el);
    return id;
  },

@@ -597,9 +597,9 @@ ElementManager.prototype = {
  },
};

this.elements = {};

elements.generateUUID = function() {
this.element = {};
element.generateUUID = function() {
  let uuid = uuidGen.generateUUID().toString();
  return uuid.substring(1, uuid.length - 1);
};
@@ -619,7 +619,7 @@ elements.generateUUID = function() {
 *     the target's bounding box.
 */
// TODO(ato): Replicated from listener.js for the time being
elements.coordinates = function(node, x = undefined, y = undefined) {
element.coordinates = function(node, x = undefined, y = undefined) {
  let box = node.getBoundingClientRect();
  if (!x) {
    x = box.width / 2.0;
@@ -645,9 +645,9 @@ elements.coordinates = function(node, x = undefined, y = undefined) {
 *     Vertical offset relative to target.  Defaults to the centre of
 *     the target's bounding box.
 */
elements.inViewport = function(el, x = undefined, y = undefined) {
element.inViewport = function(el, x = undefined, y = undefined) {
  let win = el.ownerDocument.defaultView;
  let c = elements.coordinates(el, x, y);
  let c = element.coordinates(el, x, y);
  let vp = {
    top: win.pageYOffset,
    left: win.pageXOffset,
@@ -676,7 +676,7 @@ elements.inViewport = function(el, x = undefined, y = undefined) {
 *     Vertical offset relative to target.  Defaults to the centre of
 *     the target's bounding box.
 */
elements.checkVisible = function(el, win, x = undefined, y = undefined) {
element.checkVisible = function(el, win, x = undefined, y = undefined) {
  // Bug 1094246: Webdriver's isShown doesn't work with content xul
  let ns = atom.getElementAttribute(el, "namespaceURI", win);
  if (ns.indexOf("there.is.only.xul") < 0 &&
@@ -688,10 +688,10 @@ elements.checkVisible = function(el, win, x = undefined, y = undefined) {
    return true;
  }

  if (!elements.inViewport(el, x, y)) {
  if (!element.inViewport(el, x, y)) {
    if (el.scrollIntoView) {
      el.scrollIntoView(false);
      if (!elements.inViewport(el)) {
      if (!element.inViewport(el)) {
        return false;
      }
    } else {
@@ -701,7 +701,7 @@ elements.checkVisible = function(el, win, x = undefined, y = undefined) {
  return true;
};

elements.isXULElement = function(el) {
element.isXULElement = function(el) {
  let ns = atom.getElementAttribute(el, "namespaceURI");
  return ns.indexOf("there.is.only.xul") >= 0;
};
+3 −3
Original line number Diff line number Diff line
@@ -931,10 +931,10 @@ function focusElement(element) {
 * @param {Window=} window
 */
event.sendKeysToElement = function(
    keySequence, element, opts = {}, window = undefined) {
    keySequence, el, opts = {}, window = undefined) {

  if (opts.ignoreVisibility || elements.checkVisible(element, window)) {
    focusElement(element);
  if (opts.ignoreVisibility || element.checkVisible(el, window)) {
    focusElement(el);

    // make Object.<modifier, false> map
    let modifiers = Object.create(event.Modifiers);
+4 −4
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ Interactions.prototype = {
   */
  clickElement(container, elementManager, id) {
    let el = elementManager.getKnownElement(id, container);
    let visible = elements.checkVisible(el, container.frame);
    let visible = element.checkVisible(el, container.frame);
    if (!visible) {
      throw new ElementNotVisibleError('Element is not visible');
    }
@@ -105,7 +105,7 @@ Interactions.prototype = {
      if (atom.isElementEnabled(el)) {
        this.accessibility.checkEnabled(acc, el, true, container);
        this.accessibility.checkActionable(acc, el);
        if (elements.isXULElement(el)) {
        if (element.isXULElement(el)) {
          el.click();
        } else {
          let rects = el.getClientRects();
@@ -188,7 +188,7 @@ Interactions.prototype = {
  isElementEnabled(container, elementManager, id) {
    let el = elementManager.getKnownElement(id, container);
    let enabled = true;
    if (elements.isXULElement(el)) {
    if (element.isXULElement(el)) {
      // Check if XUL element supports disabled attribute
      if (DISABLED_ATTRIBUTE_SUPPORTED_XUL.has(el.tagName.toUpperCase())) {
        let disabled = atom.getElementAttribute(el, 'disabled', container.frame);
@@ -222,7 +222,7 @@ Interactions.prototype = {
  isElementSelected(container, elementManager, id) {
    let el = elementManager.getKnownElement(id, container);
    let selected = true;
    if (elements.isXULElement(el)) {
    if (element.isXULElement(el)) {
      let tagName = el.tagName.toUpperCase();
      if (CHECKED_PROPERTY_SUPPORTED_XUL.has(tagName)) {
        selected = el.checked;
+1 −1
Original line number Diff line number Diff line
@@ -893,7 +893,7 @@ function coordinates(target, x, y) {
function singleTap(id, corx, cory) {
  let el = elementManager.getKnownElement(id, curContainer);
  // after this block, the element will be scrolled into view
  let visible = elements.checkVisible(el, curContainer.frame, corx, cory);
  let visible = element.checkVisible(el, curContainer.frame, corx, cory);
  if (!visible) {
    throw new ElementNotVisibleError("Element is not currently visible and may not be manipulated");
  }