Bug 1260312 - Retry mochitest-chrome redirection to improve reliability. r=jmaher, a=test-only
authorGeoff Brown <gbrown@mozilla.com>
Fri, 19 May 2017 12:06:14 -0600
changeset 396444 fb25233dc2f4f12ea2ba99adfbfdd55ffc806881
parent 396443 7190665d1d0e16437fa33bd3c26bfec42723fc1d
child 396445 cec923727fe67e7e8a8435b55b77bc05d633254f
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher, test-only
bugs1260312
milestone54.0
Bug 1260312 - Retry mochitest-chrome redirection to improve reliability. r=jmaher, a=test-only The mochitest-chrome harness sends a custom "contentEvent" event from redirect.html to a listener in browser-test.js. It is possible for redirect.html to be loaded and send contentEvent before the listener is set up in browser-test.js. In the absence of a better synchronization strategy, redirect.html now retries the send after a few seconds. If the first contentEvent was received, the second will be ignored; if the first contentEvent was not received, the second should avoid an intermittent harness hang and timeout.
testing/mochitest/redirect.html
--- a/testing/mochitest/redirect.html
+++ b/testing/mochitest/redirect.html
@@ -22,16 +22,18 @@
       redirect("chrome://mochikit/content/harness.xul");
     }
 
     function onLoad() {
       // Wait for MozAfterPaint, since the listener in browser-test.js is not
       // added until then.
       window.addEventListener("MozAfterPaint", function() {
         setTimeout(redirectToHarness, 0);
+        // In case the listener was not ready, try again after a few seconds.
+        setTimeout(redirectToHarness, 5000);
       }, {once: true});
 
     }
   </script>
 </head>
 
 <body onload="onLoad();">
 redirecting...