Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r?automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Fri, 04 Aug 2017 20:32:19 +0100
changeset 621396 00382746d224c9005b331164c0b192fe4f160d45
parent 621327 bc829569880635c52d6e3d54f51cd7d3df180186
child 640998 3e0b612cf99cb86bcebc893cb05abbc0f8fc434a
push id72360
push userbmo:ato@sny.no
push dateFri, 04 Aug 2017 19:33:44 +0000
reviewersautomatedtester
bugs1387559
milestone57.0a1
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
testing/marionette/assert.js
testing/marionette/driver.js
--- 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.