Compare commits

...

3 Commits

Author SHA1 Message Date
Zack Radisic
1c716e73a2 Merge branch 'main' into zack/fix-waitForPromise 2025-07-21 13:42:40 -07:00
Zack Radisic
2316ae42ee fix more cases 2025-07-17 16:53:58 -07:00
Zack Radisic
0065f3a037 drain microtasks on immediately fulfilled/rejected promises 2025-07-17 16:24:50 -07:00
3 changed files with 9 additions and 6 deletions

View File

@@ -2050,7 +2050,7 @@ fn loadPreloads(this: *VirtualMachine) !?*JSInternalPromise {
}
}
},
else => {},
.fulfilled, .rejected => this.drainMicrotasks(),
}
} else {
this.eventLoop().performGC();
@@ -2206,7 +2206,7 @@ pub fn loadEntryPointForTestRunner(this: *VirtualMachine, entry_path: string) an
}
}
},
else => {},
.fulfilled, .rejected => this.drainMicrotasks(),
}
} else {
if (promise.status(this.global.vm()) == .rejected) {
@@ -2238,7 +2238,7 @@ pub fn loadEntryPoint(this: *VirtualMachine, entry_path: string) anyerror!*JSInt
}
}
},
else => {},
.fulfilled, .rejected => this.drainMicrotasks(),
}
} else {
if (promise.status(this.global.vm()) == .rejected) {

View File

@@ -494,7 +494,7 @@ pub fn waitForPromise(this: *EventLoop, promise: JSC.AnyPromise) void {
}
}
},
else => {},
.fulfilled, .rejected => this.drainMicrotasks() catch return,
}
}
@@ -511,7 +511,7 @@ pub fn waitForPromiseWithTermination(this: *EventLoop, promise: JSC.AnyPromise)
}
}
},
else => {},
.fulfilled, .rejected => this.drainMicrotasks() catch return,
}
}

View File

@@ -427,7 +427,10 @@ pub const Run = struct {
break :brk result;
},
else => break :brk promise.result(vm.jsc),
else => {
vm.drainMicrotasks();
break :brk promise.result(vm.jsc);
},
}
}