mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
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
This commit is contained in:
parent
5ec99cbafd
commit
da6629ba61
@ -40,15 +40,15 @@ this.assert = {};
|
||||
* 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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ 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
|
||||
@ -658,13 +658,11 @@ GeckoDriver.prototype.listeningPromise = function() {
|
||||
|
||||
/** 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 {
|
||||
@ -750,7 +748,7 @@ GeckoDriver.prototype.newSession = function* (cmd, resp) {
|
||||
this.dialog = modal.findModalDialogs(this.curBrowser);
|
||||
|
||||
return {
|
||||
sessionId: this.sessionId,
|
||||
sessionId: this.sessionID,
|
||||
capabilities: this.capabilities,
|
||||
};
|
||||
};
|
||||
@ -2759,7 +2757,7 @@ GeckoDriver.prototype.deleteSession = function(cmd, resp) {
|
||||
this.sandboxes.clear();
|
||||
cert.uninstallOverride();
|
||||
|
||||
this.sessionId = null;
|
||||
this.sessionID = null;
|
||||
this.capabilities = new session.Capabilities();
|
||||
};
|
||||
|
||||
|
@ -10,7 +10,7 @@ Cu.import("chrome://marionette/content/assert.js");
|
||||
Cu.import("chrome://marionette/content/error.js");
|
||||
|
||||
add_test(function test_session() {
|
||||
assert.session({sessionId: "foo"});
|
||||
assert.session({sessionID: "foo"});
|
||||
for (let typ of [null, undefined, ""]) {
|
||||
Assert.throws(() => assert.session({sessionId: typ}), InvalidSessionIDError);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user