https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint
When a user agent is to perform a microtask checkpoint:
- If the event loop's performing a microtask checkpoint is true, then
  return. 
- Set the event loop's performing a microtask checkpoint to true. 
- While the event loop's microtask queue is not empty: - 3.1 Let oldestMicrotask be the result of dequeuing from the event loop's
  microtask queue. - 3.2 Set the event loop's currently running task to oldestMicrotask. - 3.3 Run oldestMicrotask. - This might involve invoking scripted callbacks, which eventually calls
  the clean up after running script steps, which call this perform a
  microtask checkpoint algorithm again, which is why we use the
  performing a microtask checkpoint flag to avoid reentrancy. - 3.4 Set the event loop's currently running task back to null. 
- For each environment settings object whose responsible event loop is
  this event loop, notify about rejected promises on that environment
  settings object. 
- Cleanup Indexed Database transactions. 
- Set the event loop's performing a microtask checkpoint to false. 
When an algorithm running in parallel is to await a stable state, the
  user agent must queue a microtask that runs the following steps, and
  must then stop executing (execution of the algorithm resumes when the
  microtask is run, as described in the following steps):
Run the algorithm's synchronous section.
Resumes execution of the algorithm in parallel, if appropriate, as
  described in the algorithm's steps.
Steps in synchronous sections are marked with ⌛.