Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r?automatedtester
The WebDriver service in the remote protocol accepts sessionId and
session_id and we only need on. All known consumers are using sessionId,
and we can drop the session_id fallback.
MozReview-Commit-ID: 6fa5Lgkzwfu
--- a/testing/marionette/assert.js
+++ b/testing/marionette/assert.js
@@ -35,25 +35,25 @@ this.assert = {};
* Asserts that Marionette has a session.
*
* @param {GeckoDriver} driver
* Marionette driver instance.
* @param {string=} msg
* Custom error message.
*
* @return {string}
- * Session ID.
+ * Current session's ID.
*
* @throws {InvalidSessionIDError}
- * If |driver| does not have a session ID.
+ * If <var>driver</var> does not have a session ID.
*/
assert.session = function(driver, msg = "") {
assert.that(sessionID => sessionID,
- msg, InvalidSessionIDError)(driver.sessionId);
- return driver.sessionId;
+ msg, InvalidSessionIDError)(driver.sessionID);
+ return driver.sessionID;
};
/**
* Asserts that the current browser is Firefox Desktop.
*
* @param {string=} msg
* Custom error message.
*
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -143,17 +143,17 @@ function* enumeratorIterator(enumerator)
* Description of the product, for example "Firefox".
* @param {MarionetteServer} server
* The instance of Marionette server.
*/
this.GeckoDriver = function(appName, server) {
this.appName = appName;
this._server = server;
- this.sessionId = null;
+ this.sessionID = null;
this.wins = new browser.Windows();
this.browsers = {};
// points to current browser
this.curBrowser = null;
// topmost chrome frame
this.mainFrame = null;
// chrome iframe that currently has focus
this.curFrame = null;
@@ -653,23 +653,21 @@ GeckoDriver.prototype.listeningPromise =
}
};
this.mm.addMessageListener(li, cb);
});
};
/** Create a new session. */
GeckoDriver.prototype.newSession = function* (cmd, resp) {
- if (this.sessionId) {
+ if (this.sessionID) {
throw new SessionNotCreatedError("Maximum number of active sessions");
}
- this.sessionId = cmd.parameters.sessionId ||
- cmd.parameters.session_id ||
- element.generateUUID();
+ this.sessionID = cmd.parameters.sessionId || element.generateUUID();
this.newSessionCommandId = cmd.id;
try {
this.capabilities = session.Capabilities.fromJSON(
cmd.parameters.capabilities, {merge: true});
logger.config("Matched capabilities: " +
JSON.stringify(this.capabilities));
} catch (e) {
@@ -745,17 +743,17 @@ GeckoDriver.prototype.newSession = funct
}
// Setup global listener for modal dialogs, and check if there is already
// one open for the currently selected browser window.
modal.addHandler(this.dialogHandler);
this.dialog = modal.findModalDialogs(this.curBrowser);
return {
- sessionId: this.sessionId,
+ sessionId: this.sessionID,
capabilities: this.capabilities,
};
};
/**
* Send the current session's capabilities to the client.
*
* Capabilities informs the client of which WebDriver features are
@@ -2754,17 +2752,17 @@ GeckoDriver.prototype.deleteSession = fu
this.observing = null;
}
modal.removeHandler(this.dialogHandler);
this.sandboxes.clear();
cert.uninstallOverride();
- this.sessionId = null;
+ this.sessionID = null;
this.capabilities = new session.Capabilities();
};
/**
* Takes a screenshot of a web element, current frame, or viewport.
*
* The screen capture is returned as a lossless PNG image encoded as
* a base 64 string.