Bug 1405279 - Remove unused variables. r=whimboo

MozReview-Commit-ID: CmiDVCw6xVK

--HG--
extra : rebase_source : e71cfb7da973d95c796a93cc1e4da6f709acf65e
This commit is contained in:
Andreas Tolfsen 2017-10-03 14:35:47 +01:00
parent 974c7c31f4
commit d28ce13224
23 changed files with 79 additions and 162 deletions

View File

@ -156,7 +156,7 @@ accessibility.Checks = class {
}
// Accessibility for the doc is busy, so wait for the state to change.
let eventObserver = {
observe(subject, topic, data) {
observe(subject, topic) {
if (topic !== "accessible-event") {
return;
}

View File

@ -4,7 +4,7 @@
"use strict";
const {interfaces: Ci, utils: Cu} = Components;
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");

View File

@ -4,7 +4,7 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");

View File

@ -234,9 +234,7 @@ browser.Context = class {
*/
closeWindow() {
return new Promise(resolve => {
this.window.addEventListener("unload", ev => {
resolve();
}, {once: true});
this.window.addEventListener("unload", resolve, {once: true});
this.window.close();
});
}
@ -263,16 +261,12 @@ browser.Context = class {
return new Promise((resolve, reject) => {
if (this.tabBrowser.closeTab) {
// Fennec
this.tabBrowser.deck.addEventListener("TabClose", ev => {
resolve();
}, {once: true});
this.tabBrowser.deck.addEventListener("TabClose", resolve, {once: true});
this.tabBrowser.closeTab(this.tab);
} else if (this.tabBrowser.removeTab) {
// Firefox
this.tab.addEventListener("TabClose", ev => {
resolve();
}, {once: true});
this.tab.addEventListener("TabClose", resolve, {once: true});
this.tabBrowser.removeTab(this.tab);
} else {

View File

@ -4,7 +4,7 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -4,7 +4,7 @@
"use strict";
const {Constructor: CC, interfaces: Ci, utils: Cu, classes: Cc} = Components;
const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -65,10 +65,6 @@ const ENV_ENABLED = "MOZ_MARIONETTE";
// pref being set to 4444.
const ENV_PRESERVE_PREFS = "MOZ_MARIONETTE_PREF_STATE_ACROSS_RESTARTS";
const ServerSocket = CC("@mozilla.org/network/server-socket;1",
"nsIServerSocket",
"initSpecialConnection");
const {PREF_STRING, PREF_BOOL, PREF_INT, PREF_INVALID} = Ci.nsIPrefBranch;
function getPrefVal(pref) {
@ -192,7 +188,7 @@ MarionetteComponent.prototype.handle = function(cmdLine) {
}
};
MarionetteComponent.prototype.observe = function(subject, topic, data) {
MarionetteComponent.prototype.observe = function(subject, topic) {
this.logger.debug(`Received observer notification "${topic}"`);
switch (topic) {

View File

@ -4,8 +4,6 @@
"use strict";
const {utils: Cu} = Components;
this.EXPORTED_SYMBOLS = [
"ContentEventObserverService",
"WebElementEventTarget",
@ -113,7 +111,7 @@ class WebElementEventTarget {
});
}
receiveMessage({target, name, data, objects}) {
receiveMessage({name, data, objects}) {
if (name != "Marionette:DOM:OnEvent") {
return;
}

View File

@ -7,9 +7,6 @@
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@ -29,7 +26,6 @@ Cu.import("chrome://marionette/content/cookie.js");
Cu.import("chrome://marionette/content/element.js");
const {
ElementNotInteractableError,
error,
InsecureCertificateError,
InvalidArgumentError,
InvalidCookieDomainError,
@ -755,7 +751,7 @@ GeckoDriver.prototype.listeningPromise = function() {
* @throws {SessionNotCreatedError}
* If, for whatever reason, a session could not be created.
*/
GeckoDriver.prototype.newSession = async function(cmd, resp) {
GeckoDriver.prototype.newSession = async function(cmd) {
if (this.sessionID) {
throw new SessionNotCreatedError("Maximum number of active sessions");
}
@ -870,7 +866,7 @@ GeckoDriver.prototype.getSessionCapabilities = function(cmd, resp) {
* Name of the context to be switched to. Must be one of "chrome" or
* "content".
*/
GeckoDriver.prototype.setContext = function(cmd, resp) {
GeckoDriver.prototype.setContext = function(cmd) {
let val = cmd.parameters.value;
let ctx = Context.fromString(val);
if (ctx === null) {
@ -1092,7 +1088,7 @@ GeckoDriver.prototype.execute_ = async function(
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.get = async function(cmd, resp) {
GeckoDriver.prototype.get = async function(cmd) {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1136,7 +1132,7 @@ GeckoDriver.prototype.get = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.getCurrentUrl = function(cmd) {
GeckoDriver.prototype.getCurrentUrl = function() {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1154,7 +1150,7 @@ GeckoDriver.prototype.getCurrentUrl = function(cmd) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.getTitle = function(cmd, resp) {
GeckoDriver.prototype.getTitle = function() {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1207,7 +1203,7 @@ GeckoDriver.prototype.getPageSource = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.goBack = async function(cmd, resp) {
GeckoDriver.prototype.goBack = async function() {
assert.content(this.context);
assert.contentBrowser(this.curBrowser);
assert.noUserPrompt(this.dialog);
@ -1250,7 +1246,7 @@ GeckoDriver.prototype.goBack = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.goForward = async function(cmd, resp) {
GeckoDriver.prototype.goForward = async function() {
assert.content(this.context);
assert.contentBrowser(this.curBrowser);
assert.noUserPrompt(this.dialog);
@ -1294,7 +1290,7 @@ GeckoDriver.prototype.goForward = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.refresh = async function(cmd, resp) {
GeckoDriver.prototype.refresh = async function() {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1363,7 +1359,7 @@ GeckoDriver.prototype.getIdForBrowser = function(browser) {
* @throws {NoSuchWindowError}
* Top-level browsing context has been discarded.
*/
GeckoDriver.prototype.getWindowHandle = function(cmd, resp) {
GeckoDriver.prototype.getWindowHandle = function() {
assert.contentBrowser(this.curBrowser);
return this.curBrowser.curFrameId.toString();
@ -1380,7 +1376,7 @@ GeckoDriver.prototype.getWindowHandle = function(cmd, resp) {
* @return {Array.<string>}
* Unique window handles.
*/
GeckoDriver.prototype.getWindowHandles = function(cmd, resp) {
GeckoDriver.prototype.getWindowHandles = function() {
return this.windowHandles.map(String);
};
@ -1416,7 +1412,7 @@ GeckoDriver.prototype.getChromeWindowHandle = function(cmd, resp) {
* @return {Array.<string>}
* Unique window handles.
*/
GeckoDriver.prototype.getChromeWindowHandles = function(cmd, resp) {
GeckoDriver.prototype.getChromeWindowHandles = function() {
return this.chromeWindowHandles.map(String);
};
@ -1436,7 +1432,7 @@ GeckoDriver.prototype.getChromeWindowHandles = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.getWindowRect = function(cmd, resp) {
GeckoDriver.prototype.getWindowRect = function() {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
return this.curBrowser.rect;
@ -1472,7 +1468,7 @@ GeckoDriver.prototype.getWindowRect = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.setWindowRect = async function(cmd, resp) {
GeckoDriver.prototype.setWindowRect = async function(cmd) {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1557,7 +1553,7 @@ GeckoDriver.prototype.setWindowRect = async function(cmd, resp) {
* A boolean value which determines whether to focus
* the window. Defaults to true.
*/
GeckoDriver.prototype.switchToWindow = async function(cmd, resp) {
GeckoDriver.prototype.switchToWindow = async function(cmd) {
let focus = true;
if (typeof cmd.parameters.focus != "undefined") {
focus = cmd.parameters.focus;
@ -1706,7 +1702,7 @@ GeckoDriver.prototype.getActiveFrame = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.switchToParentFrame = async function(cmd, resp) {
GeckoDriver.prototype.switchToParentFrame = async function() {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1727,7 +1723,7 @@ GeckoDriver.prototype.switchToParentFrame = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.switchToFrame = async function(cmd, resp) {
GeckoDriver.prototype.switchToFrame = async function(cmd) {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -1901,7 +1897,7 @@ GeckoDriver.prototype.switchToFrame = async function(cmd, resp) {
}
};
GeckoDriver.prototype.getTimeouts = function(cmd, resp) {
GeckoDriver.prototype.getTimeouts = function() {
return this.timeouts;
};
@ -1916,14 +1912,14 @@ GeckoDriver.prototype.getTimeouts = function(cmd, resp) {
* If timeout type key is unknown, or the value provided with it is
* not an integer.
*/
GeckoDriver.prototype.setTimeouts = function(cmd, resp) {
GeckoDriver.prototype.setTimeouts = function(cmd) {
// merge with existing timeouts
let merged = Object.assign(this.timeouts.toJSON(), cmd.parameters);
this.timeouts = session.Timeouts.fromJSON(merged);
};
/** Single tap. */
GeckoDriver.prototype.singleTap = async function(cmd, resp) {
GeckoDriver.prototype.singleTap = async function(cmd) {
assert.window(this.getCurrentWindow());
let {id, x, y} = cmd.parameters;
@ -1953,7 +1949,7 @@ GeckoDriver.prototype.singleTap = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.performActions = async function(cmd, resp) {
GeckoDriver.prototype.performActions = async function(cmd) {
assert.content(this.context,
"Command 'performActions' is not yet available in chrome context");
assert.window(this.getCurrentWindow());
@ -1973,7 +1969,7 @@ GeckoDriver.prototype.performActions = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.releaseActions = async function(cmd, resp) {
GeckoDriver.prototype.releaseActions = async function() {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2036,7 +2032,7 @@ GeckoDriver.prototype.actionChain = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.multiAction = async function(cmd, resp) {
GeckoDriver.prototype.multiAction = async function(cmd) {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2175,7 +2171,7 @@ GeckoDriver.prototype.getActiveElement = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.clickElement = async function(cmd, resp) {
GeckoDriver.prototype.clickElement = async function(cmd) {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2535,7 +2531,7 @@ GeckoDriver.prototype.getElementRect = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.sendKeysToElement = async function(cmd, resp) {
GeckoDriver.prototype.sendKeysToElement = async function(cmd) {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2566,7 +2562,7 @@ GeckoDriver.prototype.sendKeysToElement = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.clearElement = async function(cmd, resp) {
GeckoDriver.prototype.clearElement = async function(cmd) {
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2594,7 +2590,7 @@ GeckoDriver.prototype.clearElement = async function(cmd, resp) {
*
* @param {string} id element id.
*/
GeckoDriver.prototype.switchToShadowRoot = async function(cmd, resp) {
GeckoDriver.prototype.switchToShadowRoot = async function(cmd) {
assert.content(this.context);
assert.window(this.getCurrentWindow());
@ -2619,7 +2615,7 @@ GeckoDriver.prototype.switchToShadowRoot = async function(cmd, resp) {
* If <var>cookie</var> is for a different domain than the active
* document's host.
*/
GeckoDriver.prototype.addCookie = function(cmd, resp) {
GeckoDriver.prototype.addCookie = function(cmd) {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2671,7 +2667,7 @@ GeckoDriver.prototype.getCookies = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.deleteAllCookies = function(cmd, resp) {
GeckoDriver.prototype.deleteAllCookies = function() {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2692,7 +2688,7 @@ GeckoDriver.prototype.deleteAllCookies = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.deleteCookie = function(cmd, resp) {
GeckoDriver.prototype.deleteCookie = function(cmd) {
assert.content(this.context);
assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -2725,7 +2721,7 @@ GeckoDriver.prototype.deleteCookie = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.close = async function(cmd, resp) {
GeckoDriver.prototype.close = async function() {
assert.contentBrowser(this.curBrowser);
assert.noUserPrompt(this.dialog);
@ -2766,7 +2762,7 @@ GeckoDriver.prototype.close = async function(cmd, resp) {
* @return {Array.<string>}
* Unique chrome window handles of remaining chrome windows.
*/
GeckoDriver.prototype.closeChromeWindow = async function(cmd, resp) {
GeckoDriver.prototype.closeChromeWindow = async function() {
assert.firefox();
assert.window(this.getCurrentWindow(Context.CHROME));
@ -2796,7 +2792,7 @@ GeckoDriver.prototype.closeChromeWindow = async function(cmd, resp) {
};
/** Delete Marionette session. */
GeckoDriver.prototype.deleteSession = function(cmd, resp) {
GeckoDriver.prototype.deleteSession = function() {
if (this.curBrowser !== null) {
// frame scripts can be safely reused
Preferences.set(CONTENT_LISTENER_PREF, false);
@ -2884,7 +2880,7 @@ GeckoDriver.prototype.deleteSession = function(cmd, resp) {
* string. If <var>hash</var> is true, hex digest of the SHA-256
* hash of the Base64 encoded string.
*/
GeckoDriver.prototype.takeScreenshot = function(cmd, resp) {
GeckoDriver.prototype.takeScreenshot = function(cmd) {
let win = assert.window(this.getCurrentWindow());
let {id, highlights, full, hash} = cmd.parameters;
@ -2954,7 +2950,7 @@ GeckoDriver.prototype.getScreenOrientation = function(cmd, resp) {
* back to "portrait-primary" and "landscape-primary" respectively,
* and "portrait-secondary" as well as "landscape-secondary".
*/
GeckoDriver.prototype.setScreenOrientation = function(cmd, resp) {
GeckoDriver.prototype.setScreenOrientation = function(cmd) {
assert.fennec();
let win = assert.window(this.getCurrentWindow());
@ -2994,7 +2990,7 @@ GeckoDriver.prototype.setScreenOrientation = function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.minimizeWindow = async function(cmd, resp) {
GeckoDriver.prototype.minimizeWindow = async function() {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -3031,7 +3027,7 @@ GeckoDriver.prototype.minimizeWindow = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.maximizeWindow = async function(cmd, resp) {
GeckoDriver.prototype.maximizeWindow = async function() {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -3052,7 +3048,7 @@ GeckoDriver.prototype.maximizeWindow = async function(cmd, resp) {
};
// Wait for the window size to change.
async function windowSizeChange(from) {
async function windowSizeChange() {
return wait.until((resolve, reject) => {
let curSize = {
outerWidth: win.outerWidth,
@ -3117,7 +3113,7 @@ GeckoDriver.prototype.maximizeWindow = async function(cmd, resp) {
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.fullscreenWindow = async function(cmd, resp) {
GeckoDriver.prototype.fullscreenWindow = async function() {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
@ -3140,7 +3136,7 @@ GeckoDriver.prototype.fullscreenWindow = async function(cmd, resp) {
* Dismisses a currently displayed tab modal, or returns no such alert if
* no modal is displayed.
*/
GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
GeckoDriver.prototype.dismissDialog = function() {
assert.window(this.getCurrentWindow());
this._checkIfAlertIsPresent();
@ -3153,7 +3149,7 @@ GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
* Accepts a currently displayed tab modal, or returns no such alert if
* no modal is displayed.
*/
GeckoDriver.prototype.acceptDialog = function(cmd, resp) {
GeckoDriver.prototype.acceptDialog = function() {
assert.window(this.getCurrentWindow());
this._checkIfAlertIsPresent();
@ -3193,7 +3189,7 @@ GeckoDriver.prototype.getTextFromDialog = function(cmd, resp) {
* If the current user prompt is something other than an alert,
* confirm, or a prompt.
*/
GeckoDriver.prototype.sendKeysToDialog = function(cmd, resp) {
GeckoDriver.prototype.sendKeysToDialog = function(cmd) {
let win = assert.window(this.getCurrentWindow());
this._checkIfAlertIsPresent();
@ -3233,7 +3229,7 @@ GeckoDriver.prototype._checkIfAlertIsPresent = function() {
* @param {boolean} state
* True if the server should accept new socket connections.
*/
GeckoDriver.prototype.acceptConnections = function(cmd, resp) {
GeckoDriver.prototype.acceptConnections = function(cmd) {
assert.boolean(cmd.parameters.value);
this._server.acceptConnections = cmd.parameters.value;
};
@ -3313,7 +3309,7 @@ GeckoDriver.prototype.quit = async function(cmd, resp) {
resp.send();
};
GeckoDriver.prototype.installAddon = function(cmd, resp) {
GeckoDriver.prototype.installAddon = function(cmd) {
assert.firefox();
let path = cmd.parameters.path;
@ -3326,7 +3322,7 @@ GeckoDriver.prototype.installAddon = function(cmd, resp) {
return addon.install(path, temp);
};
GeckoDriver.prototype.uninstallAddon = function(cmd, resp) {
GeckoDriver.prototype.uninstallAddon = function(cmd) {
assert.firefox();
let id = cmd.parameters.id;
@ -3466,7 +3462,7 @@ GeckoDriver.prototype.localizeProperty = function(cmd, resp) {
/**
* Initialize the reftest mode
*/
GeckoDriver.prototype.setupReftest = async function(cmd, resp) {
GeckoDriver.prototype.setupReftest = async function(cmd) {
if (this._reftest) {
throw new UnsupportedOperationError(
"Called reftest:setup with a reftest session already active");
@ -3511,7 +3507,7 @@ GeckoDriver.prototype.runReftest = async function(cmd, resp) {
* Closes the reftest window (without changing the current window handle),
* and removes cached canvases.
*/
GeckoDriver.prototype.teardownReftest = function(cmd, resp) {
GeckoDriver.prototype.teardownReftest = function() {
if (!this._reftest) {
throw new UnsupportedOperationError(
"Called reftest:teardown before reftest:start");

View File

@ -924,9 +924,7 @@ element.getPointerInteractablePaintTree = function(el) {
// TODO(ato): Not implemented.
// In fact, it's not defined in the spec.
element.isKeyboardInteractable = function(el) {
return true;
};
element.isKeyboardInteractable = () => true;
/**
* Attempts to scroll into view |el|.

View File

@ -13,13 +13,12 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("chrome://marionette/content/element.js");
const {
error,
JavaScriptError,
ScriptTimeoutError,
WebDriverError,
} = Cu.import("chrome://marionette/content/error.js", {});
const logger = Log.repository.getLogger("Marionette");
const log = Log.repository.getLogger("Marionette");
this.EXPORTED_SYMBOLS = ["evaluate", "sandbox", "Sandboxes"];
@ -29,8 +28,6 @@ const COMPLETE = "__webDriverComplete";
const DEFAULT_TIMEOUT = 10000; // ms
const FINISH = "finish";
const MARIONETTE_SCRIPT_FINISHED = "marionetteScriptFinished";
const ELEMENT_KEY = "element";
const W3C_ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
/** @namespace */
this.evaluate = {};
@ -292,7 +289,7 @@ evaluate.toJSON = function(obj, seenEls) {
rv[prop] = evaluate.toJSON(obj[prop], seenEls);
} catch (e) {
if (e.result == Cr.NS_ERROR_NOT_IMPLEMENTED) {
logger.debug(`Skipping ${prop}: ${e.message}`);
log.debug(`Skipping ${prop}: ${e.message}`);
} else {
throw e;
}

View File

@ -10,21 +10,12 @@ this.event = {};
const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
Cu.import("resource://gre/modules/Log.jsm");
const logger = Log.repository.getLogger("Marionette");
Cu.import("chrome://marionette/content/element.js");
const {ElementNotInteractableError} =
Cu.import("chrome://marionette/content/error.js", {});
this.EXPORTED_SYMBOLS = ["event"];
// must be synchronised with nsIDOMWindowUtils
const COMPOSITION_ATTR_RAWINPUT = 0x02;
const COMPOSITION_ATTR_SELECTEDRAWTEXT = 0x03;
const COMPOSITION_ATTR_CONVERTEDTEXT = 0x04;
const COMPOSITION_ATTR_SELECTEDCONVERTEDTEXT = 0x05;
// TODO(ato): Document!
let seenEvent = false;

View File

@ -11,7 +11,6 @@ Cu.import("chrome://marionette/content/atom.js");
const {
ElementClickInterceptedError,
ElementNotInteractableError,
InvalidArgument,
InvalidArgumentError,
InvalidElementStateError,
pprint,
@ -325,7 +324,7 @@ interaction.selectOption = function(el) {
*/
interaction.flushEventLoop = async function(win) {
return new Promise(resolve => {
let handleEvent = event => {
let handleEvent = () => {
win.removeEventListener("beforeunload", this);
resolve();
};

View File

@ -15,7 +15,7 @@
* content retrieved.
*/
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");

View File

@ -7,12 +7,8 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const uuidGen = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator);
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
const winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
@ -49,8 +45,6 @@ Cu.import("chrome://marionette/content/session.js");
Cu.importGlobalProperties(["URL"]);
let marionetteTestName;
let listenerId = null; // unique ID of this listener
let curContainer = {frame: content, shadowRoot: null};
let previousContainer = null;
@ -71,50 +65,17 @@ let capabilities;
let legacyactions = new legacyaction.Chain(checkForInterrupted);
// the unload handler
let onunload;
// Flag to indicate whether an async script is currently running or not.
let asyncTestRunning = false;
let asyncTestCommandId;
let asyncTestTimeoutId;
let inactivityTimeoutId = null;
let originalOnError;
// Send move events about this often
let EVENT_INTERVAL = 30; // milliseconds
// last touch for each fingerId
let multiLast = {};
const asyncChrome = proxy.toChromeAsync({
addMessageListener: addMessageListenerId.bind(this),
removeMessageListener: removeMessageListenerId.bind(this),
sendAsyncMessage: sendAsyncMessage.bind(this),
});
const syncChrome = proxy.toChrome(sendSyncMessage.bind(this));
const logger = Log.repository.getLogger("Marionette");
// Append only once to avoid duplicated output after listener.js gets reloaded
if (logger.ownAppenders.length == 0) {
logger.addAppender(new Log.DumpAppender());
}
const modalHandler = function() {
// This gets called on the system app only since it receives the
// mozbrowserprompt event
sendSyncMessage("Marionette:switchedToFrame",
{frameValue: null, storePrevious: true});
let isLocal = sendSyncMessage("MarionetteFrame:handleModal", {})[0].value;
if (isLocal) {
previousContainer = curContainer;
}
curContainer = {frame: content, shadowRoot: null};
};
// sandbox storage and name of the current sandbox
const sandboxes = new Sandboxes(() => curContainer.frame);
let sandboxName = "default";
const eventObservers = new ContentEventObserverService(
content, sendAsyncMessage.bind(this));
@ -384,7 +345,7 @@ const loadListener = {
}
},
observe(subject, topic, data) {
observe(subject, topic) {
const win = curContainer.frame;
const winID = subject.QueryInterface(Ci.nsISupportsPRUint64).data;
const curWinID = win.QueryInterface(Ci.nsIInterfaceRequestor)
@ -454,7 +415,7 @@ const loadListener = {
return (async () => {
await trigger();
})().then(val => {
})().then(() => {
if (!loadEventExpected) {
sendOk(commandID);
return;
@ -636,7 +597,7 @@ function newSession(msg) {
* Puts the current session to sleep, so all listeners are removed except
* for the 'restart' listener.
*/
function sleepSession(msg) {
function sleepSession() {
deleteSession();
addMessageListener("Marionette:restart", restart);
}
@ -644,7 +605,7 @@ function sleepSession(msg) {
/**
* Restarts all our listeners after this listener was put to sleep
*/
function restart(msg) {
function restart() {
removeMessageListener("Marionette:restart", restart);
registerSelf();
}
@ -652,7 +613,7 @@ function restart(msg) {
/**
* Removes all listeners
*/
function deleteSession(msg) {
function deleteSession() {
removeMessageListenerId("Marionette:newSession", newSession);
removeMessageListenerId("Marionette:execute", executeFn);
removeMessageListenerId("Marionette:executeInSandbox", executeInSandboxFn);

View File

@ -6,8 +6,6 @@
const {utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("chrome://marionette/content/assert.js");
Cu.import("chrome://marionette/content/error.js");
@ -18,8 +16,6 @@ this.EXPORTED_SYMBOLS = [
"Response",
];
const logger = Log.repository.getLogger("Marionette");
/**
* Messages may originate from either the server or the client.
* Because the remote protocol is full duplex, both endpoints may be the

View File

@ -4,7 +4,7 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
const {utils: Cu} = Components;
Cu.importGlobalProperties(["URL"]);

View File

@ -390,9 +390,9 @@ function RawPacket(transport, data) {
RawPacket.prototype = Object.create(Packet.prototype);
RawPacket.prototype.read = function(stream) {
// This hasn't yet been needed for testing.
throw Error("Not implmented.");
RawPacket.prototype.read = function() {
// this has not yet been needed for testing
throw new Error("Not implemented");
};
RawPacket.prototype.write = function(stream) {

View File

@ -4,7 +4,7 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
const {interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");

View File

@ -4,10 +4,8 @@
"use strict";
const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu} = Components;
const {Constructor: CC, interfaces: Ci, utils: Cu} = Components;
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader);
const ServerSocket = CC(
"@mozilla.org/network/server-socket;1",
"nsIServerSocket",
@ -460,7 +458,7 @@ server.TCPConnection = class {
* Debugger transport callback that cleans up
* after a connection is closed.
*/
onClosed(reason) {
onClosed() {
this.driver.deleteSession();
if (this.onclose) {
this.onclose(this);

View File

@ -8,21 +8,14 @@ const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.importGlobalProperties(["URL"]);
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("chrome://marionette/content/assert.js");
const {
error,
InvalidArgumentError,
} = Cu.import("chrome://marionette/content/error.js", {});
const {InvalidArgumentError} = Cu.import("chrome://marionette/content/error.js", {});
this.EXPORTED_SYMBOLS = ["session"];
const logger = Log.repository.getLogger("Marionette");
const {pprint} = error;
// Enable testing this module, as Services.appinfo.* is not available
// in xpcshell tests.
const appinfo = {name: "<missing>", version: "<missing>"};

View File

@ -195,7 +195,7 @@ StreamCopier.prototype = {
this._streamReadyCallback();
},
_debug(msg) {
_debug() {
},
};

View File

@ -6,8 +6,7 @@
/* global Pipe, ScriptableInputStream, uneval */
const {Constructor: CC, classes: Cc, interfaces: Ci, utils: Cu, results: Cr} =
Components;
const {Constructor: CC, classes: Cc, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/EventEmitter.jsm");

View File

@ -11,6 +11,7 @@ const {
TimeoutError,
} = Cu.import("chrome://marionette/content/error.js", {});
/* exported TimedPromise */
this.EXPORTED_SYMBOLS = ["wait", "TimedPromise"];
/**
@ -150,7 +151,7 @@ function TimedPromise(fn, {timeout = 1500, throws = TimeoutError} = {}) {
return new Promise((resolve, reject) => {
// Reject only if |throws| is given. Otherwise it is assumed that
// the user is OK with the promise timing out.
let bail = res => {
let bail = () => {
if (throws !== null) {
let err = new throws();
reject(err);