Bug 1578008 - Make promiseRDMZoom more simple and reliable. r=bradwerth

Now that we no longer have the various resolution shenanigans, we really
just want to ensure that child processes observe the resize of the
<browser> element, which can happen just fine if we ensure to flush
layout.

Differential Revision: https://phabricator.services.mozilla.com/D72552
This commit is contained in:
Emilio Cobos Álvarez 2020-04-29 21:44:05 +00:00
Родитель 0169492da2
Коммит 94e88b71b3
2 изменённых файлов: 14 добавлений и 15 удалений

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

@ -93,4 +93,3 @@ tags = devtools geolocation
[browser_viewport_zoom_toggle.js]
[browser_window_close.js]
[browser_window_sizing.js]
skip-if = (os == 'linux' && bits == 64) || (os == 'mac') #Bug 1578008

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

@ -924,22 +924,22 @@ function promiseContentReflow(ui) {
// This function returns a promise that will be resolved when the
// RDM zoom has been set and the content has finished rescaling
// to the new size.
function promiseRDMZoom(ui, browser, zoom) {
return new Promise(resolve => {
async function promiseRDMZoom(ui, browser, zoom) {
const currentZoom = ZoomManager.getZoomForBrowser(browser);
if (currentZoom.toFixed(2) == zoom.toFixed(2)) {
resolve();
return;
}
const zoomComplete = BrowserTestUtils.waitForEvent(
browser,
"FullZoomResolutionStable"
);
const width = browser.getBoundingClientRect().width;
ZoomManager.setZoomForBrowser(browser, zoom);
// Await the zoom complete event, then reflow.
zoomComplete.then(promiseContentReflow(ui)).then(resolve);
// RDM resizes the browser as a result of a zoom change, so we wait for that.
//
// This also has the side effect of updating layout which ensures that any
// remote frame dimension update message gets there in time.
await BrowserTestUtils.waitForCondition(function() {
return browser.getBoundingClientRect().width != width;
});
}