Bug 1245153 - Rename actions.js to action.js; r=automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Wed, 03 Feb 2016 19:25:28 +0000
changeset 332781 c4b890c3fbcd6952d1c4a63a321a7cf35c5cd1ee
parent 332780 0b30f291ed1aee3f4073f2fea47ac4d9c6a6a576
child 332782 ccea6a57262a6a6d66a65ff392adae142f80472b
push id11232
push useratolfsen@mozilla.com
push dateSun, 21 Feb 2016 12:02:10 +0000
reviewersautomatedtester
bugs1245153
milestone47.0a1
Bug 1245153 - Rename actions.js to action.js; r=automatedtester MozReview-Commit-ID: 58v7aMH2deS
testing/marionette/action.js
testing/marionette/actions.js
testing/marionette/driver.js
testing/marionette/event.js
testing/marionette/jar.mn
testing/marionette/listener.js
rename from testing/marionette/actions.js
rename to testing/marionette/action.js
--- a/testing/marionette/actions.js
+++ b/testing/marionette/action.js
@@ -7,26 +7,26 @@ const {classes: Cc, interfaces: Ci, util
 Cu.import("resource://gre/modules/Log.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 
 Cu.import("chrome://marionette/content/event.js");
 
 const CONTEXT_MENU_DELAY_PREF = "ui.click_hold_context_menus.delay";
 const DEFAULT_CONTEXT_MENU_DELAY = 750;  // ms
 
-this.EXPORTED_SYMBOLS = ["actions"];
+this.EXPORTED_SYMBOLS = ["action"];
 
 const logger = Log.repository.getLogger("Marionette");
 
-this.actions = {};
+this.action = {};
 
 /**
  * Functionality for (single finger) action chains.
  */
-actions.Chain = function(checkForInterrupted) {
+action.Chain = function(checkForInterrupted) {
   // for assigning unique ids to all touches
   this.nextTouchId = 1000;
   // keep track of active Touches
   this.touchIds = {};
   // last touch for each fingerId
   this.lastCoordinates = null;
   this.isTap = false;
   this.scrolling = false;
@@ -42,17 +42,17 @@ actions.Chain = function(checkForInterru
   } else {
     this.checkForInterrupted = () => {};
   }
 
   // determines if we create touch events
   this.inputSource = null;
 };
 
-actions.Chain.prototype.dispatchActions = function(
+action.Chain.prototype.dispatchActions = function(
     args,
     touchId,
     container,
     elementManager,
     callbacks,
     touchProvider) {
   // Some touch events code in the listener needs to do ipc, so we can't
   // share this code across chrome/content.
@@ -100,17 +100,17 @@ actions.Chain.prototype.dispatchActions 
  *     Number of clicks, button notes the mouse button.
  * @param {number} elClientX
  *     X coordinate of the mouse relative to the viewport.
  * @param {number} elClientY
  *     Y coordinate of the mouse relative to the viewport.
  * @param {Object} modifiers
  *     An object of modifier keys present.
  */
-actions.Chain.prototype.emitMouseEvent = function(
+action.Chain.prototype.emitMouseEvent = function(
     doc,
     type,
     elClientX,
     elClientY,
     button,
     clickCount,
     modifiers) {
   if (!this.checkForInterrupted()) {
@@ -142,33 +142,33 @@ actions.Chain.prototype.emitMouseEvent =
         0,
         this.inputSource);
   }
 };
 
 /**
  * Reset any persisted values after a command completes.
  */
-actions.Chain.prototype.resetValues = function() {
+action.Chain.prototype.resetValues = function() {
   this.onSuccess = null;
   this.onError = null;
   this.container = null;
   this.elementManager = null;
   this.touchProvider = null;
   this.mouseEventsOnly = false;
 };
 
 /**
  * Function to emit touch events for each finger. e.g.
  * finger=[['press', id], ['wait', 5], ['release']] touchId represents
  * the finger id, i keeps track of the current action of the chain
  * keyModifiers is an object keeping track keyDown/keyUp pairs through
  * an action chain.
  */
-actions.Chain.prototype.actions = function(chain, touchId, i, keyModifiers) {
+action.Chain.prototype.actions = function(chain, touchId, i, keyModifiers) {
   if (i == chain.length) {
     this.onSuccess(touchId || null);
     this.resetValues();
     return;
   }
 
   let pack = chain[i];
   let command = pack[0];
@@ -318,17 +318,17 @@ actions.Chain.prototype.actions = functi
  *     The target to calculate coordinates of.
  * @param {number} x
  *     X coordinate relative to target.  If unspecified, the centre of
  *     the target is used.
  * @param {number} y
  *     Y coordinate relative to target.  If unspecified, the centre of
  *     the target is used.
  */
-actions.Chain.prototype.coordinates = function(target, x, y) {
+action.Chain.prototype.coordinates = function(target, x, y) {
   let box = target.getBoundingClientRect();
   if (x == null) {
     x = box.width / 2;
   }
   if (y == null) {
     y = box.height / 2;
   }
   let coords = {};
@@ -336,17 +336,17 @@ actions.Chain.prototype.coordinates = fu
   coords.y = box.top + y;
   return coords;
 };
 
 /**
  * Given an element and a pair of coordinates, returns an array of the
  * form [clientX, clientY, pageX, pageY, screenX, screenY].
  */
-actions.Chain.prototype.getCoordinateInfo = function(el, corx, cory) {
+action.Chain.prototype.getCoordinateInfo = function(el, corx, cory) {
   let win = el.ownerDocument.defaultView;
   return [
     corx, // clientX
     cory, // clientY
     corx + win.pageXOffset, // pageX
     cory + win.pageYOffset, // pageY
     corx + win.mozInnerScreenX, // screenX
     cory + win.mozInnerScreenY // screenY
@@ -356,17 +356,17 @@ actions.Chain.prototype.getCoordinateInf
 /**
  * @param {number} x
  *     X coordinate of the location to generate the event that is relative
  *     to the viewport.
  * @param {number} y
  *     Y coordinate of the location to generate the event that is relative
  *     to the viewport.
  */
-actions.Chain.prototype.generateEvents = function(
+action.Chain.prototype.generateEvents = function(
     type, x, y, touchId, target, keyModifiers) {
   this.lastCoordinates = [x, y];
   let doc = this.container.frame.document;
 
   switch (type) {
     case "tap":
       if (this.mouseEventsOnly) {
         this.mouseTap(
@@ -489,13 +489,13 @@ actions.Chain.prototype.generateEvents =
       break;
 
     default:
       throw new WebDriverError("Unknown event type: " + type);
   }
   this.checkForInterrupted();
 };
 
-actions.Chain.prototype.mouseTap = function(doc, x, y, button, count, mod) {
+action.Chain.prototype.mouseTap = function(doc, x, y, button, count, mod) {
   this.emitMouseEvent(doc, "mousemove", x, y, button, count, mod);
   this.emitMouseEvent(doc, "mousedown", x, y, button, count, mod);
   this.emitMouseEvent(doc, "mouseup", x, y, button, count, mod);
 };
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -18,17 +18,17 @@ Cu.import("resource://gre/modules/Task.j
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 var {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
 this.DevToolsUtils = devtools.require("devtools/shared/DevToolsUtils");
 
 XPCOMUtils.defineLazyServiceGetter(
     this, "cookieManager", "@mozilla.org/cookiemanager;1", "nsICookieManager2");
 
-Cu.import("chrome://marionette/content/actions.js");
+Cu.import("chrome://marionette/content/action.js");
 Cu.import("chrome://marionette/content/atom.js");
 Cu.import("chrome://marionette/content/interaction.js");
 Cu.import("chrome://marionette/content/element.js");
 Cu.import("chrome://marionette/content/event.js");
 Cu.import("chrome://marionette/content/frame-manager.js");
 Cu.import("chrome://marionette/content/error.js");
 Cu.import("chrome://marionette/content/modal.js");
 Cu.import("chrome://marionette/content/proxy.js");
@@ -128,17 +128,17 @@ this.GeckoDriver = function(appName, dev
   this.currentFrameElement = null;
   this.testName = null;
   this.mozBrowserClose = null;
   this.sandboxes = {};
   // frame ID of the current remote frame, used for mozbrowserclose events
   this.oopFrameId = null;
   this.observing = null;
   this._browserIds = new WeakMap();
-  this.actions = new actions.Chain();
+  this.actions = new action.Chain();
 
   this.sessionCapabilities = {
     // mandated capabilities
     "browserName": Services.appinfo.name,
     "browserVersion": Services.appinfo.version,
     "platformName": Services.sysinfo.getProperty("name"),
     "platformVersion": Services.sysinfo.getProperty("version"),
     "specificationLevel": "1",
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -155,17 +155,17 @@ event.sendString = function(string, wind
  * in the nsIDOMKeyEvent constant name for this key.  No modifiers are
  * handled at this point.
  */
 event.sendKey = function(key, window = undefined) {
   let keyName = "VK_" + key.toUpperCase();
   event.synthesizeKey(keyName, {shiftKey: false}, window);
 };
 
-// TODO(ato): Unexpose this when actions.Chain#emitMouseEvent
+// TODO(ato): Unexpose this when action.Chain#emitMouseEvent
 // no longer emits its own events
 event.parseModifiers_ = function(event) {
   let mval = 0;
   if (event.shiftKey) {
     mval |= Ci.nsIDOMNSEvent.SHIFT_MASK;
   }
   if (event.ctrlKey) {
     mval |= Ci.nsIDOMNSEvent.CONTROL_MASK;
--- a/testing/marionette/jar.mn
+++ b/testing/marionette/jar.mn
@@ -1,17 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 marionette.jar:
 % content marionette %content/
   content/server.js (server.js)
   content/driver.js (driver.js)
-  content/actions.js (actions.js)
+  content/action.js (action.js)
   content/interaction.js (interaction.js)
   content/accessibility.js (accessibility.js)
   content/listener.js (listener.js)
   content/element.js (element.js)
   content/common.js (common.js)
   content/simpletest.js (simpletest.js)
   content/frame-manager.js (frame-manager.js)
   content/event.js  (event.js)
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -8,17 +8,17 @@ var uuidGen = Cc["@mozilla.org/uuid-gene
     .getService(Ci.nsIUUIDGenerator);
 
 var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
     .getService(Ci.mozIJSSubScriptLoader);
 
 loader.loadSubScript("chrome://marionette/content/simpletest.js");
 loader.loadSubScript("chrome://marionette/content/common.js");
 
-Cu.import("chrome://marionette/content/actions.js");
+Cu.import("chrome://marionette/content/action.js");
 Cu.import("chrome://marionette/content/atom.js");
 Cu.import("chrome://marionette/content/capture.js");
 Cu.import("chrome://marionette/content/cookies.js");
 Cu.import("chrome://marionette/content/element.js");
 Cu.import("chrome://marionette/content/error.js");
 Cu.import("chrome://marionette/content/event.js");
 Cu.import("chrome://marionette/content/proxy.js");
 Cu.import("chrome://marionette/content/interaction.js");
@@ -40,17 +40,17 @@ var curContainer = { frame: content, sha
 var isRemoteBrowser = () => curContainer.frame.contentWindow !== null;
 var previousContainer = null;
 var elementManager = new ElementManager([]);
 
 // Holds session capabilities.
 var capabilities = {};
 var interactions = new Interactions(() => capabilities);
 
-var actions = new actions.Chain(checkForInterrupted);
+var actions = new action.Chain(checkForInterrupted);
 var importedScripts = null;
 
 // Contains the last file input element that was the target of
 // sendKeysToElement.
 var fileInputElement;
 
 // A dict of sandboxes used this session
 var sandboxes = {};