DevTools/mochitests coding standards: Difference between revisions

Removing the custom asyncTest function with the native add_task
(Removing the custom asyncTest function with the native add_task)
(Removing the custom asyncTest function with the native add_task)
Line 134: Line 134:
=== Callbacks and promises ===
=== Callbacks and promises ===
Avoid multiple nested callbacks or chained promises. They make it hard to read the code.
Avoid multiple nested callbacks or chained promises. They make it hard to read the code.
Thanks to our task-based asyncTest function (see the markupview head.js support file for instance), it's easy to write asynchronous code that looks like flat, synchronous, code.
Thanks to add_task, it's easy to write asynchronous code that looks like flat, synchronous, code.


=== Clean up after yourself ===
=== Clean up after yourself ===
130

edits