Bug 1026290: Delay mochitest-chrome redirect until after MozAfterPaint; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Wed, 19 Nov 2014 15:43:28 -0700
changeset 240878 6d8adc89991c59a374092f02d220e52aa1effe12
parent 240877 5d895a54de81cfd46cc1b5986311333fbadaa7df
child 240879 e46da4d0299d557964d01276c5efb2b37fc2f596
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1026290
milestone36.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 1026290: Delay mochitest-chrome redirect until after MozAfterPaint; r=jmaher
testing/mochitest/redirect.html
--- a/testing/mochitest/redirect.html
+++ b/testing/mochitest/redirect.html
@@ -12,18 +12,29 @@
         detail: {
           "data": aURL + location.search,
           "type": "loadURI"
         }
       });
       document.dispatchEvent(event);
     }
 
+    function redirectToHarness()
+    {
+      redirect("chrome://mochikit/content/harness.xul");
+    }
+
     function onLoad() {
-      redirect("chrome://mochikit/content/harness.xul");
+      // Wait for MozAfterPaint, since the listener in browser-test.js is not
+      // added until then.
+      window.addEventListener("MozAfterPaint", function testOnMozAfterPaint() {
+        window.removeEventListener("MozAfterPaint", testOnMozAfterPaint);
+        setTimeout(redirectToHarness, 0);
+      });
+
     }
   </script>
 </head>
 
 <body onload="onLoad();">
 redirecting...
 </body>
 </html>