Bug 1415783 - Flush pending style, layout and paint and wait for a MozAfterPaint before waiting for MozAfterPaint for OMT animation. r?birtles
With the conformant Promise handling (
bug 1193394), there happen to receive
unexpected MozAfterPaint while waiting for MozAfterPaint for OMT animation.
The safest way to avoid this confusion is to start test refresh mode and
flush all pending styles (layout and paint) there so that the unexpected
MozAfterPaint is absorbed there.
MozReview-Commit-ID: 2xdKe4InYcP
--- a/layout/style/test/animation_utils.js
+++ b/layout/style/test/animation_utils.js
@@ -253,18 +253,23 @@ function runOMTATest(aTestFunction, aOnS
if (utils.isTestControllingRefreshes) {
utils.restoreNormalRefresh();
}
};
return waitForDocumentLoad()
.then(loadPaintListener)
.then(function() {
- // Put refresh driver under test control and trigger animation
+ // Put refresh driver under test control and flush all pending style,
+ // layout and paint to avoid the situation that waitForPaintsFlush()
+ // receives unexpected MozAfterpaint event for those pending
+ // notifications.
utils.advanceTimeAndRefresh(0);
+ return waitForPaintsFlushed();
+ }).then(function() {
div.style.animation = animationName + " 10s";
return waitForPaintsFlushed();
}).then(function() {
var opacity = utils.getOMTAStyle(div, "opacity");
cleanUp();
return Promise.resolve(opacity == 0.5);
}).catch(function(err) {