From d613409de04ac055bee8a22f127577fa1745a7e5 Mon Sep 17 00:00:00 2001 From: Alistair Smith Date: Tue, 3 Jun 2025 13:41:44 -0700 Subject: [PATCH] addressing some pr feedback --- src/bun.js/bindings/ScriptExecutionContext.cpp | 12 ++++++------ src/bun.js/bindings/webcore/MessagePort.cpp | 2 +- src/bun.js/event_loop.zig | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bun.js/bindings/ScriptExecutionContext.cpp b/src/bun.js/bindings/ScriptExecutionContext.cpp index 47f49a9465..644dde8a84 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.cpp +++ b/src/bun.js/bindings/ScriptExecutionContext.cpp @@ -366,34 +366,34 @@ ScriptExecutionContext* executionContext(JSC::JSGlobalObject* globalObject) void ScriptExecutionContext::postTaskConcurrently(Function&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); - reinterpret_cast(m_globalObject)->queueTaskConcurrently(task); + static_cast(m_globalObject)->queueTaskConcurrently(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(Function&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); - reinterpret_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTask(EventLoopTask* task) { - reinterpret_cast(m_globalObject)->queueTask(task); + static_cast(m_globalObject)->queueTask(task); } // Executes the task on context's thread immediately. void ScriptExecutionContext::postImmediateCppTask(Function&& lambda) { auto* task = new EventLoopTask(WTFMove(lambda)); - reinterpret_cast(m_globalObject)->queueImmediateCppTask(task); + static_cast(m_globalObject)->queueImmediateCppTask(task); } // Executes the task on context's thread immediately. void ScriptExecutionContext::postImmediateCppTask(EventLoopTask* task) { - reinterpret_cast(m_globalObject)->queueImmediateCppTask(task); + static_cast(m_globalObject)->queueImmediateCppTask(task); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTaskOnTimeout(EventLoopTask* task, Seconds timeout) { - reinterpret_cast(m_globalObject)->queueTaskOnTimeout(task, static_cast(timeout.milliseconds())); + static_cast(m_globalObject)->queueTaskOnTimeout(task, static_cast(timeout.milliseconds())); } // Executes the task on context's thread asynchronously. void ScriptExecutionContext::postTaskOnTimeout(Function&& lambda, Seconds timeout) diff --git a/src/bun.js/bindings/webcore/MessagePort.cpp b/src/bun.js/bindings/webcore/MessagePort.cpp index 73408b3868..3bbd76a675 100644 --- a/src/bun.js/bindings/webcore/MessagePort.cpp +++ b/src/bun.js/bindings/webcore/MessagePort.cpp @@ -313,7 +313,7 @@ void MessagePort::dispatchMessages() auto messagesTakenHandler = [this, protectedThis = Ref { *this }](Vector&& messages, CompletionHandler&& completionCallback) mutable { RefPtr context = scriptExecutionContext(); if (!context || !context->globalObject()) { - WTFMove(completionCallback)(); + completionCallback(); return; } diff --git a/src/bun.js/event_loop.zig b/src/bun.js/event_loop.zig index 14ad827c93..fc96de0fed 100644 --- a/src/bun.js/event_loop.zig +++ b/src/bun.js/event_loop.zig @@ -121,7 +121,7 @@ pub fn drainMicrotasksWithGlobal(this: *EventLoop, globalObject: *JSC.JSGlobalOb // this exists because while we're inside a spawnSync call, some tasks can actually // still complete which leads to a case where module resolution can partially complete and - // some modules are only partialy evaluated which causes reference errors. + // some modules are only partially evaluated which causes reference errors. // TODO: A better fix here could be a second event loop so we can come off the main one // while processing spawnSync, then resume back to here afterwards if (this.is_inside_spawn_sync) {