Bug 1849298 - Fix test_bug1451199-2.html to guarantee change events are reported. r=hiro

This probably regressed in bug 1451717. Make whether the change event
gets fired reliable by waiting for a refresh driver tick rather than
flushing layout.

Differential Revision: https://phabricator.services.mozilla.com/D189064
This commit is contained in:
Emilio Cobos Álvarez 2023-09-25 05:58:08 +00:00
Родитель 0041ccdca3
Коммит 57f94ca1d5
1 изменённых файлов: 5 добавлений и 4 удалений

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

@ -13,13 +13,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1451199
/** Test for Bug 1451199 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
addLoadEvent(async function() {
// We have to be careful to not check l.matches until the very end
// of the test.
var l = frames[0].matchMedia("(orientation: portrait)");
var iframe = document.querySelector("iframe");
const l = frames[0].matchMedia("(orientation: portrait)");
const iframe = document.querySelector("iframe");
iframe.width = "50";
iframe.contentDocument.documentElement.offsetWidth; // Flush layout
await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)));
l.addEventListener("change", function() {
is(l.matches, false,