summaryrefslogtreecommitdiff
path: root/core/01_core.js
diff options
context:
space:
mode:
Diffstat (limited to 'core/01_core.js')
-rw-r--r--core/01_core.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/01_core.js b/core/01_core.js
index 13aa17c7e..d4a6508cb 100644
--- a/core/01_core.js
+++ b/core/01_core.js
@@ -187,7 +187,16 @@
const cb = macrotaskCallbacks[i];
while (true) {
const res = cb();
+
+ // If callback returned `undefined` then it has no work to do, we don't
+ // need to perform microtask checkpoint.
+ if (res === undefined) {
+ break;
+ }
+
ops.op_run_microtasks();
+ // If callback returned `true` then it has no more work to do, stop
+ // calling it then.
if (res === true) {
break;
}