Tim Guan-tin Chien
2018-10-08 22:12:36 UTC
Hi,
While working on other bugs, I realized if add_task() function calls are
scattered in multiple JS files or theologically multiple inline <script>
blocks, the tests might start without running the add_task() functions in
the latter block/files.
This is because the first add_task() starts the tests only after one
setTimeout(), and depend on how slow the parser put the latter JS
block/files in the event queue, the later add_task() calls might not be run
after the setTimeout() is executed, thus fail to add the test functions
into the array before the tests start.
I've addressed this in https://bugzilla.mozilla.org/show_bug.cgi?id=1496636
. A check is added to ensure tests start only after all the add_task()
calls are run (given that they should be in the inline <script> blocks).
This means you should no longer wait for DOMContentLoaded or load in the
test functions because the document is already loaded. Doing so will result
in a timeout anyway.
I suspect this was a source of intermittent failure, given this is
essentially a race between the parser and event queue.
Thanks,
Tim
While working on other bugs, I realized if add_task() function calls are
scattered in multiple JS files or theologically multiple inline <script>
blocks, the tests might start without running the add_task() functions in
the latter block/files.
This is because the first add_task() starts the tests only after one
setTimeout(), and depend on how slow the parser put the latter JS
block/files in the event queue, the later add_task() calls might not be run
after the setTimeout() is executed, thus fail to add the test functions
into the array before the tests start.
I've addressed this in https://bugzilla.mozilla.org/show_bug.cgi?id=1496636
. A check is added to ensure tests start only after all the add_task()
calls are run (given that they should be in the inline <script> blocks).
This means you should no longer wait for DOMContentLoaded or load in the
test functions because the document is already loaded. Doing so will result
in a timeout anyway.
I suspect this was a source of intermittent failure, given this is
essentially a race between the parser and event queue.
Thanks,
Tim