--- a/dom/animation/test/mozilla/file_restyles.html+++ b/dom/animation/test/mozilla/file_restyles.html@@ -127,28 +127,16 @@ function waitForWheelEvent(aTarget) { sendWheelAndPaintNoFlush(aTarget, centerX, centerY, { deltaMode: WheelEvent.DOM_DELTA_PIXEL, deltaY: targetRect.height }, resolve); }); }-async function waitForAnimationReadyToRestyle(aAnimation) {- await aAnimation.ready;- // If |aAnimation| begins at the current timeline time, we will not process- // restyling in the initial frame because of aligning with the refresh driver,- // the animation frame in which the ready promise is resolved happens to- // coincide perfectly with the start time of the animation. In this case no- // restyling is needed in the frame so we have to wait one more frame.- if (animationStartsRightNow(aAnimation)) {- await waitForNextFrame();- }-}- var omtaEnabled = isOMTAEnabled(); var isAndroid = !!navigator.userAgent.includes("Android"); const isWebRender = SpecialPowers.DOMWindowUtils.layerManagerType == 'WebRender'; function add_task_if_omta_enabled(test) { if (!omtaEnabled) {

--- a/dom/animation/test/testcommon.js+++ b/dom/animation/test/testcommon.js@@ -418,8 +418,20 @@ function waitForPaints() { // asynchronously (e.g. using play()) and then ended up running the next frame // at precisely the time the animation started (due to aligning with vsync // refresh rate) then we won't end up restyling in that frame. function animationStartsRightNow(aAnimation) { return aAnimation.startTime === aAnimation.timeline.currentTime && aAnimation.currentTime === 0; }+// Waits for a given animation being ready to restyle.+async function waitForAnimationReadyToRestyle(aAnimation) {+ await aAnimation.ready;+ // If |aAnimation| begins at the current timeline time, we will not process+ // restyling in the initial frame because of aligning with the refresh driver,+ // the animation frame in which the ready promise is resolved happens to+ // coincide perfectly with the start time of the animation. In this case no+ // restyling is needed in the frame so we have to wait one more frame.+ if (animationStartsRightNow(aAnimation)) {+ await waitForNextFrame();+ }+}