diff options
author | 2023-08-08 22:19:46 -0700 | |
---|---|---|
committer | 2023-08-08 22:19:46 -0700 | |
commit | 009fe18fa269247ae533608fa524c442b69b8f3a (patch) | |
tree | ae57b67c32487c9dd7f7e3c567f1a2a740433dcb /src/bun.js | |
parent | 40d00a961ec4aa4398e18bada520eaf5791151cc (diff) | |
download | bun-009fe18fa269247ae533608fa524c442b69b8f3a.tar.gz bun-009fe18fa269247ae533608fa524c442b69b8f3a.tar.zst bun-009fe18fa269247ae533608fa524c442b69b8f3a.zip |
worker tests (#4058)
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/Process.cpp | 4 | ||||
-rw-r--r-- | src/bun.js/bindings/webcore/Worker.cpp | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp index 8dcfd8daa..9a09eca66 100644 --- a/src/bun.js/bindings/Process.cpp +++ b/src/bun.js/bindings/Process.cpp @@ -397,7 +397,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExit, Process__dispatchOnExit(zigGlobal, exitCode); Bun__Process__exit(zigGlobal, exitCode); - __builtin_unreachable(); + return JSC::JSValue::encode(jsUndefined()); } extern "C" uint64_t Bun__readOriginTimer(void*); @@ -1156,7 +1156,7 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionReallyExit, (JSGlobalObject * globalObj zigGlobal = Bun__getDefaultGlobal(); } Bun__Process__exit(zigGlobal, exitCode); - __builtin_unreachable(); + return JSC::JSValue::encode(jsUndefined()); } template<typename Visitor> diff --git a/src/bun.js/bindings/webcore/Worker.cpp b/src/bun.js/bindings/webcore/Worker.cpp index 6579e3190..92503bbbd 100644 --- a/src/bun.js/bindings/webcore/Worker.cpp +++ b/src/bun.js/bindings/webcore/Worker.cpp @@ -210,6 +210,9 @@ ExceptionOr<void> Worker::postMessage(JSC::JSGlobalObject& state, JSC::JSValue m void Worker::terminate() { + if (m_wasTerminated) { + return; + } // m_contextProxy.terminateWorkerGlobalScope(); m_wasTerminated = true; WebWorker__terminate(impl_); @@ -285,7 +288,6 @@ void Worker::drainEvents() void Worker::dispatchOnline(Zig::GlobalObject* workerGlobalObject) { - auto* ctx = scriptExecutionContext(); if (ctx) { ScriptExecutionContext::postTaskTo(ctx->identifier(), [protectedThis = Ref { *this }](ScriptExecutionContext& context) -> void { |