1
0
Fork 0
firefox/testing/web-platform/tests/common/rendering-utils.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

19 lines
559 B
JavaScript

"use strict";
/**
* Waits until we have at least one frame rendered, regardless of the engine.
*
* @returns {Promise}
*/
function waitForAtLeastOneFrame() {
return new Promise(resolve => {
// Different web engines work slightly different on this area but waiting
// for two requestAnimationFrames() to happen, one after another, should be
// sufficient to ensure at least one frame has been generated anywhere.
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
resolve();
});
});
});
}