Bug 1332122 - Remove unnecessary wrapper browser.startSession().
This wrapper just calls back into the MarionetteDriver, and
doesn't have any value. Removing it simplifies the call stack.
MozReview-Commit-ID: GH1xUHX12Xi
--- a/testing/marionette/browser.js
+++ b/testing/marionette/browser.js
@@ -229,21 +229,16 @@ browser.Context = class {
return new Promise(resolve => {
this.window.addEventListener("unload", ev => {
resolve();
}, {once: true});
this.window.close();
});
}
- /** Called when we start a session with this browser. */
- startSession(newSession, win, callback) {
- callback(win, newSession);
- }
-
/**
* Close the current tab.
*
* @return {Promise}
* A promise which is resolved when the current tab has been closed.
*
* @throws UnsupportedOperationError
* If tab handling for the current application isn't supported.
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -468,18 +468,17 @@ GeckoDriver.prototype.addBrowser = funct
* @param {boolean=false} isNewSession
* True if this is the first time we're talking to this browser.
*/
GeckoDriver.prototype.startBrowser = function(win, isNewSession = false) {
this.mainFrame = win;
this.curFrame = null;
this.addBrowser(win);
this.curBrowser.isNewSession = isNewSession;
- this.curBrowser.startSession(
- isNewSession, win, this.whenBrowserStarted.bind(this));
+ this.whenBrowserStarted(win, isNewSession);
};
/**
* Callback invoked after a new session has been started in a browser.
* Loads the Marionette frame script into the browser if needed.
*
* @param {nsIDOMWindow} win
* Window whose browser we need to access.
@@ -703,18 +702,19 @@ GeckoDriver.prototype.newSession = funct
this.startBrowser(win, true);
}
};
if (!Preferences.get(CONTENT_LISTENER_PREF)) {
waitForWindow.call(this);
} else if (this.appName != "Firefox" && this.curBrowser === null) {
// if there is a content listener, then we just wake it up
- this.addBrowser(this.getCurrentWindow());
- this.curBrowser.startSession(this.whenBrowserStarted.bind(this));
+ let win = this.getCurrentWindow();
+ this.addBrowser(win);
+ this.whenBrowserStarted(win, false);
this.mm.broadcastAsyncMessage("Marionette:restart", {});
} else {
throw new WebDriverError("Session already running");
}
this.switchToGlobalMessageManager();
yield registerBrowsers;
yield browserListening;