From cb4390c05201cf7f2f992edf835574ce1369bc61 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren
Set the performing a microtask checkpoint flag to true.
Let the performing a microtask checkpoint flag be true.
Microtask queue handling: If the event loop's microtask - queue is empty, jump to the done step below.
While the event loop's microtask queue is not empty:
-Select the oldest microtask on the event loop's microtask - queue.
Let oldestMicrotask be the oldest microtask on the event + loop's microtask queue.
Set the event loop's currently running task to the task selected in the previous step.
Set the event loop's currently running task to + oldestMicrotask.
Run: Run oldestMicrotask.
-Run: Run the selected task.
+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.
+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.
+Set the event loop's currently running task back to + null.
Remove oldestMicrotask from the microtask queue.
Set the event loop's currently running task back to - null.
Remove the microtask run in the step above from the microtask - queue, and return to the microtask queue handling step.
Done: For each environment settings object whose responsible - event loop is this event loop, notify about rejected promises - on that environment settings object.
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.
Let the performing a microtask checkpoint flag be false.
Set the performing a microtask checkpoint flag to false.
If, while a compound microtask is running, the user agent is required to