Bug 1462980 - Use the more robust waitUntilApzStable instead of ad-hoc afterPaint waiting. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 15 Oct 2018 17:44:27 +0000
changeset 497050 ba86672c033d9578ec99d0aa70eecbfedac28b46
parent 497049 7e55a78b333997c6ccf98ee3669dc284648ea3c8
child 497051 de0c544a16b95a244d1113a2e03f13c83a632e8c
push id9996
push userarchaeopteryx@coole-files.de
push dateThu, 18 Oct 2018 18:37:15 +0000
treeherdermozilla-beta@8efe26839243 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1462980
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1462980 - Use the more robust waitUntilApzStable instead of ad-hoc afterPaint waiting. r=botond Differential Revision: https://phabricator.services.mozilla.com/D8748
gfx/layers/apz/test/mochitest/helper_bug982141.html
--- a/gfx/layers/apz/test/mochitest/helper_bug982141.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug982141.html
@@ -3,49 +3,37 @@
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=982141
 -->
 <head>
   <meta charset="utf-8">
   <meta name="viewport" content="user-scalable=no">
   <title>Test for Bug 982141, helper page</title>
   <script type="application/javascript" src="apz_test_utils.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
   <script type="application/javascript">
 
     // -------------------------------------------------------------------
     // Infrastructure to get the test assertions to run at the right time.
     // -------------------------------------------------------------------
     var SimpleTest = window.opener.SimpleTest;
 
-    window.onload = function() {
-        window.addEventListener("MozAfterPaint", afterPaint);
-    };
-    var utils = SpecialPowers.getDOMWindowUtils(window);
-    function afterPaint(e) {
-      // If there is another paint pending, wait for it.
-      if (utils.isMozAfterPaintPending) {
-          return;
-      }
-
-      // Once there are no more paints pending, remove the
-      // MozAfterPaint listener and run the test logic.
-      window.removeEventListener("MozAfterPaint", afterPaint);
-      testBug982141();
-    }
+    waitUntilApzStable().then(testBug982141);
 
     // --------------------------------------------------------------------
     // The actual logic for testing bug 982141.
     //
     // In this test we have a simple page with a scrollable <div> which has
     // enough content to make it scrollable. We test that this <div> got
     // a displayport.
     // --------------------------------------------------------------------
 
     function testBug982141() {
       // Get the content- and compositor-side test data from nsIDOMWindowUtils.
+      var utils = SpecialPowers.getDOMWindowUtils(window);
       var contentTestData = utils.getContentAPZTestData();
       var compositorTestData = utils.getCompositorAPZTestData();
 
       // Get the sequence number of the last paint on the compositor side.
       // We do this before converting the APZ test data because the conversion
       // loses the order of the paints.
       SimpleTest.ok(compositorTestData.paints.length > 0,
                     "expected at least one paint in compositor test data");