Bug 1339317 - Make browser_windowopen_reflows.js more resilient to compositor races. r?Gijs
MozReview-Commit-ID: IsPJ4hzFQ4b
--- a/browser/base/content/test/general/browser_windowopen_reflows.js
+++ b/browser/base/content/test/general/browser_windowopen_reflows.js
@@ -103,15 +103,19 @@ var observer = {
// We're not interested in interruptible reflows.
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIReflowObserver,
Ci.nsISupportsWeakReference])
};
function waitForMozAfterPaint(win, callback) {
+ let dwu = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ let lastTransactionId = dwu.lastTransactionId;
+
win.addEventListener("MozAfterPaint", function onEnd(event) {
- if (event.target != win)
+ if (event.target != win || event.transactionId <= lastTransactionId)
return;
win.removeEventListener("MozAfterPaint", onEnd);
executeSoon(callback);
});
}