Bug 1742797 - Fix intermittent test failures, r=hiro.

Depends on D151481

Differential Revision: https://phabricator.services.mozilla.com/D151480
This commit is contained in:
Florian Quèze 2022-07-19 19:56:22 +00:00
Родитель 4907d4f03c
Коммит ab3e31f024
2 изменённых файлов: 34 добавлений и 11 удалений

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

@ -34,20 +34,31 @@ add_task(
// Should not already be using vsync
ok(!ChromeUtils.vsyncEnabled(), "vsync should be off initially");
if (
AppConstants.platform == "linux" &&
DownloadsPanel.panel.state != "open"
) {
// Panels sometime receive spurious popuphiding events on Linux.
// Given the main target of this test is Windows, avoid causing
// intermittent failures and just make the test return early.
todo(
false,
"panel should still be 'open', current state: " +
DownloadsPanel.panel.state
);
return;
}
const hiddenPromise = BrowserTestUtils.waitForEvent(
DownloadsPanel.panel,
"popuphidden"
);
EventUtils.synthesizeNativeMouseEvent({
type: "click",
target: downloadsButton,
atCenter: true,
});
await Promise.all([
hiddenPromise,
TestUtils.waitForCondition(() => !ChromeUtils.vsyncEnabled()),
]);
EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
await hiddenPromise;
await TestUtils.waitForCondition(
() => !ChromeUtils.vsyncEnabled(),
"wait for vsync to be disabled again"
);
ok(!ChromeUtils.vsyncEnabled(), "vsync should still be off");
is(
@ -55,5 +66,14 @@ add_task(
"closed",
"Check that panel state is 'closed'"
);
// Move the cursor to the center of the browser window where hopefully it
// will cause less intermittent failures in the next tests than keeping it
// in the toolbar area.
EventUtils.synthesizeNativeMouseEvent({
type: "mousemove",
target: document.documentElement,
atCenter: true,
});
}
);

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

@ -1099,7 +1099,10 @@ void nsMenuPopupFrame::HidePopup(bool aDeselectMenu, nsPopupState aNewState) {
mHFlip = mVFlip = false;
if (auto* widget = GetWidget()) {
widget->ClearCachedWebrenderResources();
// Ideally we should call ClearCachedWebrenderResources but there are
// intermittent failures (see bug 1748788), so we currently call
// ClearWebrenderAnimationResources instead.
widget->ClearWebrenderAnimationResources();
}
nsView* view = GetView();