Bug 1320389 - Rename legacyactions; r?ato
MozReview-Commit-ID: 7fImbYQsvJh
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -13,17 +13,16 @@ Cu.import("resource://gre/modules/Log.js
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(
this, "cookieManager", "@mozilla.org/cookiemanager;1", "nsICookieManager2");
Cu.import("chrome://marionette/content/accessibility.js");
-Cu.import("chrome://marionette/content/action.js");
Cu.import("chrome://marionette/content/addon.js");
Cu.import("chrome://marionette/content/assert.js");
Cu.import("chrome://marionette/content/atom.js");
Cu.import("chrome://marionette/content/browser.js");
Cu.import("chrome://marionette/content/cert.js");
Cu.import("chrome://marionette/content/element.js");
Cu.import("chrome://marionette/content/error.js");
Cu.import("chrome://marionette/content/evaluate.js");
@@ -134,17 +133,17 @@ this.GeckoDriver = function (appName, se
// The curent context decides if commands should affect chrome- or
// content space.
this.context = Context.CONTENT;
this.importedScripts = new evaluate.ScriptStorageService(
[Context.CHROME, Context.CONTENT]);
this.sandboxes = new Sandboxes(() => this.getCurrentWindow());
- this.actions = new action.Chain();
+ this.legacyactions = new legacyaction.Chain();
this.timer = null;
this.inactivityTimer = null;
this.marionetteLog = new logging.ContentLogger();
this.testName = null;
this.sessionCapabilities = {
@@ -174,18 +173,16 @@ this.GeckoDriver = function (appName, se
let handleDialog = (subject, topic) => {
let winr;
if (topic == modal.COMMON_DIALOG_LOADED) {
winr = Cu.getWeakReference(subject);
}
this.dialog = new modal.Dialog(() => this.curBrowser, winr);
};
modal.addHandler(handleDialog);
-
- this.actions = new action.Chain();
};
GeckoDriver.prototype.QueryInterface = XPCOMUtils.generateQI([
Ci.nsIMessageListener,
Ci.nsIObserver,
Ci.nsISupportsWeakReference
]);
@@ -1665,17 +1662,17 @@ GeckoDriver.prototype.actionChain = func
if (this.appName != "Firefox") {
// be conservative until this has a use case and is established
// to work as expected on b2g/fennec
throw new WebDriverError(
"Command 'actionChain' is not available in chrome context");
}
let win = this.getCurrentWindow();
- resp.body.value = yield this.actions.dispatchActions(
+ resp.body.value = yield this.legacyactions.dispatchActions(
chain, nextId, {frame: win}, this.curBrowser.seenEls);
break;
case Context.CONTENT:
this.addFrameCloseListener("action chain");
resp.body.value = yield this.listener.actionChain(chain, nextId);
break;
}
@@ -2856,18 +2853,18 @@ GeckoDriver.prototype.commands = {
"getLogs": GeckoDriver.prototype.getLogs,
"setContext": GeckoDriver.prototype.setContext,
"getContext": GeckoDriver.prototype.getContext,
"executeScript": GeckoDriver.prototype.executeScript,
"getTimeouts": GeckoDriver.prototype.getTimeouts,
"timeouts": GeckoDriver.prototype.setTimeouts, // deprecated until Firefox 55
"setTimeouts": GeckoDriver.prototype.setTimeouts,
"singleTap": GeckoDriver.prototype.singleTap,
- "actionChain": GeckoDriver.prototype.actionChain,
- "multiAction": GeckoDriver.prototype.multiAction,
+ "actionChain": GeckoDriver.prototype.actionChain, // deprecated
+ "multiAction": GeckoDriver.prototype.multiAction, // deprecated
"executeAsyncScript": GeckoDriver.prototype.executeAsyncScript,
"executeJSScript": GeckoDriver.prototype.executeJSScript,
"findElement": GeckoDriver.prototype.findElement,
"findElements": GeckoDriver.prototype.findElements,
"clickElement": GeckoDriver.prototype.clickElement,
"getElementAttribute": GeckoDriver.prototype.getElementAttribute,
"getElementProperty": GeckoDriver.prototype.getElementProperty,
"getElementText": GeckoDriver.prototype.getElementText,
--- a/testing/marionette/legacyaction.js
+++ b/testing/marionette/legacyaction.js
@@ -8,21 +8,21 @@ Cu.import("resource://gre/modules/Log.js
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("chrome://marionette/content/element.js");
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 = ["action"];
+this.EXPORTED_SYMBOLS = ["legacyaction"];
const logger = Log.repository.getLogger("Marionette");
-this.action = {};
+this.legacyaction = this.action = {};
/**
* Functionality for (single finger) action chains.
*/
action.Chain = function (checkForInterrupted) {
// for assigning unique ids to all touches
this.nextTouchId = 1000;
// keep track of active Touches
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -54,17 +54,17 @@ var SUPPORTED_STRATEGIES = new Set([
element.Strategy.LinkText,
element.Strategy.PartialLinkText,
element.Strategy.TagName,
element.Strategy.XPath,
]);
var capabilities = {};
-var actions = new action.Chain(checkForInterrupted);
+var legacyactions = new legacyaction.Chain(checkForInterrupted);
// the unload handler
var onunload;
// Flag to indicate whether an async script is currently running or not.
var asyncTestRunning = false;
var asyncTestCommandId;
var asyncTestTimeoutId;
@@ -137,17 +137,17 @@ function registerSelf() {
}
sendAsyncMessage("Marionette:listenersAttached", rv);
}
}
}
function emitTouchEventForIFrame(message) {
message = message.json;
- let identifier = actions.nextTouchId;
+ let identifier = legacyactions.nextTouchId;
let domWindowUtils = curContainer.frame.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var ratio = domWindowUtils.screenPixelsPerCSSPixel;
var typeForUtils;
switch (message.type) {
@@ -324,17 +324,17 @@ function newSession(msg) {
resetValues();
if (isB2G) {
readyStateTimer.initWithCallback(waitForReady, 100, Ci.nsITimer.TYPE_ONE_SHOT);
// We have to set correct mouse event source to MOZ_SOURCE_TOUCH
// to offer a way for event listeners to differentiate
// events being the result of a physical mouse action.
// This is especially important for the touch event shim,
// in order to prevent creating touch event for these fake mouse events.
- actions.inputSource = Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH;
+ legacyactions.inputSource = Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH;
}
}
/**
* Puts the current session to sleep, so all listeners are removed except
* for the 'restart' listener. This is used to keep the content listener
* alive for reuse in B2G instead of reloading it each time.
*/
@@ -404,17 +404,17 @@ function deleteSession(msg) {
removeMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
if (isB2G) {
content.removeEventListener("mozbrowsershowmodalprompt", modalHandler, false);
}
seenEls.clear();
// reset container frame to the top-most frame
curContainer = { frame: content, shadowRoot: null };
curContainer.frame.focus();
- actions.touchIds = {};
+ legacyactions.touchIds = {};
}
/**
* Send asynchronous reply to chrome.
*
* @param {UUID} uuid
* Unique identifier of the request.
* @param {AsyncContentSender.ResponseType} type
@@ -472,17 +472,17 @@ function sendLog(msg) {
}
/**
* Clear test values after completion of test
*/
function resetValues() {
sandboxes.clear();
curContainer = {frame: content, shadowRoot: null};
- actions.mouseEventsOnly = false;
+ legacyactions.mouseEventsOnly = false;
}
/**
* Dump a logline to stdout. Prepends logline with a timestamp.
*/
function dumpLog(logline) {
dump(Date.now() + " Marionette: " + logline);
}
@@ -502,17 +502,17 @@ function wasInterrupted() {
}
return sendSyncMessage("MarionetteFrame:getInterruptedState", {})[0].value;
}
function checkForInterrupted() {
if (wasInterrupted()) {
if (previousContainer) {
// if previousContainer is set, then we're in a single process environment
- curContainer = actions.container = previousContainer;
+ curContainer = legacyactions.container = previousContainer;
previousContainer = null;
}
else {
//else we're in OOP environment, so we'll switch to the original OOP frame
sendSyncMessage("Marionette:switchToModalOrigin");
}
sendSyncMessage("Marionette:switchedToFrame", { restorePrevious: true });
}
@@ -591,17 +591,17 @@ function setTestName(msg) {
function emitTouchEvent(type, touch) {
if (!wasInterrupted()) {
let loggingInfo = "emitting Touch event of type " + type + " to element with id: " + touch.target.id + " and tag name: " + touch.target.tagName + " at coordinates (" + touch.clientX + ", " + touch.clientY + ") relative to the viewport";
dumpLog(loggingInfo);
var docShell = curContainer.frame.document.defaultView.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIDocShell);
- if (docShell.asyncPanZoomEnabled && actions.scrolling) {
+ if (docShell.asyncPanZoomEnabled && legacyactions.scrolling) {
// if we're in APZ and we're scrolling, we must use sendNativeTouchPoint to dispatch our touchmove events
let index = sendSyncMessage("MarionetteFrame:getCurrentFrameId");
// only call emitTouchEventForIFrame if we're inside an iframe.
if (index != null) {
sendSyncMessage("Marionette:emitTouchEvent",
{ index: index, type: type, id: touch.identifier,
clientX: touch.clientX, clientY: touch.clientY,
screenX: touch.screenX, screenY: touch.screenY,
@@ -635,51 +635,51 @@ function singleTap(id, corx, cory) {
throw new ElementNotVisibleError("Element is not currently visible and may not be manipulated");
}
let a11y = accessibility.get(capabilities.raisesAccessibilityExceptions);
return a11y.getAccessible(el, true).then(acc => {
a11y.assertVisible(acc, el, visible);
a11y.assertActionable(acc, el);
if (!curContainer.frame.document.createTouch) {
- actions.mouseEventsOnly = true;
+ legacyactions.mouseEventsOnly = true;
}
let c = element.coordinates(el, corx, cory);
- if (!actions.mouseEventsOnly) {
- let touchId = actions.nextTouchId++;
+ if (!legacyactions.mouseEventsOnly) {
+ let touchId = legacyactions.nextTouchId++;
let touch = createATouch(el, c.x, c.y, touchId);
emitTouchEvent('touchstart', touch);
emitTouchEvent('touchend', touch);
}
- actions.mouseTap(el.ownerDocument, c.x, c.y);
+ legacyactions.mouseTap(el.ownerDocument, c.x, c.y);
});
}
/**
* Function to create a touch based on the element
* corx and cory are relative to the viewport, id is the touchId
*/
function createATouch(el, corx, cory, touchId) {
let doc = el.ownerDocument;
let win = doc.defaultView;
let [clientX, clientY, pageX, pageY, screenX, screenY] =
- actions.getCoordinateInfo(el, corx, cory);
+ legacyactions.getCoordinateInfo(el, corx, cory);
let atouch = doc.createTouch(win, el, touchId, pageX, pageY, screenX, screenY, clientX, clientY);
return atouch;
}
/**
* Start action chain on one finger.
*/
function actionChain(chain, touchId) {
let touchProvider = {};
touchProvider.createATouch = createATouch;
touchProvider.emitTouchEvent = emitTouchEvent;
- return actions.dispatchActions(
+ return legacyactions.dispatchActions(
chain,
touchId,
curContainer,
seenEls,
touchProvider);
}
/**