Bug 1381876 - Return window rect from Context#rect consistently. r?automatedtester
MozReview-Commit-ID: D5pCPK2PEr3
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -2906,36 +2906,27 @@ GeckoDriver.prototype.setScreenOrientati
* @throws {UnexpectedAlertOpenError}
* A modal dialog is open, blocking this operation.
*/
GeckoDriver.prototype.minimizeWindow = function* (cmd, resp) {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
- let state;
yield new Promise(resolve => {
win.addEventListener("sizemodechange", resolve, {once: true});
if (win.windowState == win.STATE_MINIMIZED) {
win.restore();
- state = "normal";
} else {
win.minimize();
- state = "minimized";
}
});
- resp.body = {
- x: win.screenX,
- y: win.screenY,
- width: win.outerWidth,
- height: win.outerHeight,
- state,
- };
+ return this.curBrowser.rect;
};
/**
* Synchronously maximizes the user agent window as if the user pressed
* the maximize button, or restores it if it is already maximized.
*
* Not supported on Fennec.
*
@@ -2959,22 +2950,17 @@ GeckoDriver.prototype.maximizeWindow = f
if (win.windowState == win.STATE_MAXIMIZED) {
win.restore();
} else {
win.maximize();
}
});
- resp.body = {
- x: win.screenX,
- y: win.screenY,
- width: win.outerWidth,
- height: win.outerHeight,
- };
+ return this.curBrowser.rect;
};
/**
* Synchronously sets the user agent window to full screen as if the user
* had done "View > Enter Full Screen", or restores it if it is already
* in full screen.
*
* Not supported on Fennec.
@@ -2991,26 +2977,20 @@ GeckoDriver.prototype.maximizeWindow = f
*/
GeckoDriver.prototype.fullscreen = function* (cmd, resp) {
assert.firefox();
const win = assert.window(this.getCurrentWindow());
assert.noUserPrompt(this.dialog);
yield new Promise(resolve => {
win.addEventListener("sizemodechange", resolve, {once: true});
-
win.fullScreen = !win.fullScreen;
});
- resp.body = {
- x: win.screenX,
- y: win.screenY,
- width: win.outerWidth,
- height: win.outerHeight,
- };
+ return this.curBrowser.rect;
};
/**
* Dismisses a currently displayed tab modal, or returns no such alert if
* no modal is displayed.
*/
GeckoDriver.prototype.dismissDialog = function(cmd, resp) {
assert.window(this.getCurrentWindow());