Bug 1339317 - Make browser_windowopen_reflows.js more resilient to compositor races. r?Gijs draft
authorMike Conley <mconley@mozilla.com>
Fri, 17 Feb 2017 13:52:48 -0500
changeset 486265 a6cea371bfb79e0791f9c4a4337e67d4ceb93968
parent 481595 25a94c1047e793ef096d8556fa3c26dd72bd37d7
child 546205 8ff5903176175dc4e4cf72997d966e935ae4f82b
push id45937
push usermconley@mozilla.com
push dateFri, 17 Feb 2017 18:53:24 +0000
reviewersGijs
bugs1339317
milestone54.0a1
Bug 1339317 - Make browser_windowopen_reflows.js more resilient to compositor races. r?Gijs MozReview-Commit-ID: IsPJ4hzFQ4b
browser/base/content/test/general/browser_windowopen_reflows.js
--- 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);
   });
 }