Bug 1478358 - [marionette] Don't wait for resize events in "Set Window Rect". r=ato

Differential Revision: https://phabricator.services.mozilla.com/D16338

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2019-01-14 15:24:54 +00:00
Родитель 461f107cb9
Коммит b67d0c309e
1 изменённых файлов: 3 добавлений и 16 удалений

Просмотреть файл

@ -1455,27 +1455,14 @@ GeckoDriver.prototype.setWindowRect = async function(cmd) {
break;
}
if (height != null && width != null) {
if (width != null && height != null) {
assert.positiveInteger(height);
assert.positiveInteger(width);
let debounce = new DebounceCallback(() => {
win.dispatchEvent(new win.CustomEvent("resizeEnd"));
});
await new TimedPromise(async resolve => {
if (win.outerWidth == width && win.outerHeight == height) {
resolve();
return;
}
win.addEventListener("resize", debounce);
win.addEventListener("resizeEnd", resolve, {once: true});
if (win.outerWidth != width || win.outerHeight != height) {
win.resizeTo(width, height);
await new IdlePromise(win);
}, {timeout: 5000});
win.removeEventListener("resize", debounce);
}
}
if (x != null && y != null) {