Bug 1260312 - Retry mochitest-chrome redirection to improve reliability; r=jmaher

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.
This commit is contained in:
Geoff Brown 2017-05-19 12:06:14 -06:00
parent 935d7cfd4b
commit 9552c26f47

View File

@ -27,6 +27,8 @@
// 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});
}