Bug 753273 - Wait for window and browser at the start of newSession, r=mdas, a=test-only, DONTBUILD because NPOTB

This commit is contained in:
Jonathan Griffin 2012-05-10 11:42:54 -07:00
parent eaf20f3009
commit bda6cf19b6

View File

@ -336,8 +336,21 @@ MarionetteDriverActor.prototype = {
*
*/
newSession: function MDA_newSession() {
function waitForWindow() {
let checkTimer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
let win = this.getCurrentWindow();
if (!win || (appName != "B2G" && !win.gBrowser)) {
checkTimer.initWithCallback(waitForWindow.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
}
else {
this.startBrowser(win, true);
}
}
if (!prefs.getBoolPref("marionette.contentListener")) {
this.startBrowser(this.getCurrentWindow(), true);
waitForWindow.call(this);
}
else if ((appName == "B2G") && (this.curBrowser == null)) {
//if there is a content listener, then we just wake it up