mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
bug 1492499: marionette: empty event queue on window manipulation; r=automatedtester,whimboo
This requests an animation frame off ChromeWindow and waits for the main thread's event queue to become idle in relation to window manipulation commands. It additionally clears the event queue before resizing, because this is a particularly hazardous operation. We don't know the exact science as to why this is needed, so it may just be that this introduces enough latency for the operation to complete successfully. File this under "secret sauce". This ensures all potential synchronisation code between e.g. the parent process and the child processes have had time to run before we return from WebDriver:{MinimizeWindow,MaximizeWindow,FullscreenWindow}. Depends on D8418 Differential Revision: https://phabricator.services.mozilla.com/D8419 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d0917b9009
commit
de7f55fcf0
@ -1471,6 +1471,7 @@ GeckoDriver.prototype.setWindowRect = async function(cmd) {
|
||||
win.addEventListener("resize", debounce);
|
||||
win.addEventListener("resizeEnd", resolve, {once: true});
|
||||
win.resizeTo(width, height);
|
||||
await new IdlePromise(win);
|
||||
}, {timeout: 5000});
|
||||
|
||||
win.removeEventListener("resize", debounce);
|
||||
@ -1482,6 +1483,7 @@ GeckoDriver.prototype.setWindowRect = async function(cmd) {
|
||||
|
||||
if (win.screenX != x || win.screenY != y) {
|
||||
win.moveTo(x, y);
|
||||
await new IdlePromise(win);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2986,6 +2988,7 @@ GeckoDriver.prototype.minimizeWindow = async function() {
|
||||
win.addEventListener("visibilitychange", resolve, {once: true});
|
||||
win.minimize();
|
||||
}, {throws: null});
|
||||
await new IdlePromise(win);
|
||||
}
|
||||
|
||||
return this.curBrowser.rect;
|
||||
@ -3032,6 +3035,7 @@ GeckoDriver.prototype.maximizeWindow = async function() {
|
||||
win.maximize();
|
||||
}, {throws: null});
|
||||
win.removeEventListener("sizemodechange", cb);
|
||||
await new IdlePromise(win);
|
||||
}
|
||||
|
||||
return this.curBrowser.rect;
|
||||
@ -3073,6 +3077,7 @@ GeckoDriver.prototype.fullscreenWindow = async function() {
|
||||
}, {throws: null});
|
||||
win.removeEventListener("sizemodechange", cb);
|
||||
}
|
||||
await new IdlePromise(win);
|
||||
|
||||
return this.curBrowser.rect;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user