diff --git a/src/bun.js/VirtualMachine.zig b/src/bun.js/VirtualMachine.zig index 221d0e0b2c..c4203762ce 100644 --- a/src/bun.js/VirtualMachine.zig +++ b/src/bun.js/VirtualMachine.zig @@ -720,7 +720,7 @@ pub fn reload(this: *VirtualMachine, _: *HotReloader.Task) void { Output.enableBuffering(); } - this.global.reload(); + this.global.reload() catch @panic("Failed to reload"); this.hot_reload_counter += 1; this.pending_internal_promise = this.reloadEntryPoint(this.main) catch @panic("Failed to reload"); } diff --git a/src/bun.js/bindings/ErrorCode.cpp b/src/bun.js/bindings/ErrorCode.cpp index 633f4e1143..9a1dea3f75 100644 --- a/src/bun.js/bindings/ErrorCode.cpp +++ b/src/bun.js/bindings/ErrorCode.cpp @@ -1602,7 +1602,6 @@ extern "C" JSC::EncodedJSValue Bun__wrapAbortError(JSC::JSGlobalObject* lexicalG { auto* globalObject = defaultGlobalObject(lexicalGlobalObject); auto& vm = JSC::getVM(globalObject); - auto scope = DECLARE_THROW_SCOPE(vm); auto cause = JSC::JSValue::decode(causeParam); if (cause.isUndefined()) { diff --git a/src/bun.js/bindings/JSGlobalObject.zig b/src/bun.js/bindings/JSGlobalObject.zig index 101ccc8781..67dda87776 100644 --- a/src/bun.js/bindings/JSGlobalObject.zig +++ b/src/bun.js/bindings/JSGlobalObject.zig @@ -230,12 +230,10 @@ pub const JSGlobalObject = opaque { return this.throwValue(this.createNotEnoughArguments(name_, expected, got)); } - extern fn JSC__JSGlobalObject__reload(JSC__JSGlobalObject__ptr: *JSGlobalObject) void; - pub fn reload(this: *jsc.JSGlobalObject) void { + pub fn reload(this: *jsc.JSGlobalObject) !void { this.vm().drainMicrotasks(); this.vm().collectAsync(); - - JSC__JSGlobalObject__reload(this); + try bun.cpp.JSC__JSGlobalObject__reload(this); } pub const BunPluginTarget = enum(u8) { diff --git a/src/bun.js/bindings/JSValue.zig b/src/bun.js/bindings/JSValue.zig index f8a54edcd2..7816629942 100644 --- a/src/bun.js/bindings/JSValue.zig +++ b/src/bun.js/bindings/JSValue.zig @@ -1110,12 +1110,10 @@ pub const JSValue = enum(i64) { return bun.String.fromJS(this, globalObject); } - extern fn JSC__JSValue__toMatch(this: JSValue, global: *JSGlobalObject, other: JSValue) bool; - /// this: RegExp value /// other: string value - pub fn toMatch(this: JSValue, global: *JSGlobalObject, other: JSValue) bool { - return JSC__JSValue__toMatch(this, global, other); + pub fn toMatch(this: JSValue, global: *JSGlobalObject, other: JSValue) !bool { + return bun.cpp.JSC__JSValue__toMatch(this, global, other); } extern fn JSC__JSValue__asArrayBuffer_(this: JSValue, global: *JSGlobalObject, out: *ArrayBuffer) bool; diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index be58d1e4e5..3c070e4bcd 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -4123,12 +4123,14 @@ void GlobalObject::reload() { JSModuleLoader* moduleLoader = this->moduleLoader(); auto& vm = this->vm(); - JSC::JSMap* registry = jsCast(moduleLoader->get( - this, - Identifier::fromString(vm, "registry"_s))); + auto scope = DECLARE_THROW_SCOPE(vm); + JSC::JSMap* registry = jsCast(moduleLoader->get(this, Identifier::fromString(vm, "registry"_s))); + RETURN_IF_EXCEPTION(scope, ); registry->clear(this); + RETURN_IF_EXCEPTION(scope, ); this->requireMap()->clear(this); + RETURN_IF_EXCEPTION(scope, ); // If we run the GC every time, we will never get the SourceProvider cache hit. // So we run the GC every other time. @@ -4137,7 +4139,7 @@ void GlobalObject::reload() } } -extern "C" void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0) +extern "C" [[ZIG_EXPORT(check_slow)]] void JSC__JSGlobalObject__reload(JSC::JSGlobalObject* arg0) { Zig::GlobalObject* globalObject = static_cast(arg0); globalObject->reload(); diff --git a/src/bun.js/bindings/bindings.cpp b/src/bun.js/bindings/bindings.cpp index a8fce2532d..17e8784a1c 100644 --- a/src/bun.js/bindings/bindings.cpp +++ b/src/bun.js/bindings/bindings.cpp @@ -4362,7 +4362,7 @@ JSC::JSObject* JSC__JSValue__toObject(JSC::EncodedJSValue JSValue0, JSC::JSGloba return value.toStringOrNull(arg1); } -bool JSC__JSValue__toMatch(JSC::EncodedJSValue regexValue, JSC::JSGlobalObject* global, JSC::EncodedJSValue value) +[[ZIG_EXPORT(check_slow)]] bool JSC__JSValue__toMatch(JSC::EncodedJSValue regexValue, JSC::JSGlobalObject* global, JSC::EncodedJSValue value) { ASSERT_NO_PENDING_EXCEPTION(global); JSC::JSValue regex = JSC::JSValue::decode(regexValue); diff --git a/src/bun.js/test/expect/toMatch.zig b/src/bun.js/test/expect/toMatch.zig index c4d3fcba6c..c774969bf5 100644 --- a/src/bun.js/test/expect/toMatch.zig +++ b/src/bun.js/test/expect/toMatch.zig @@ -33,7 +33,7 @@ pub fn toMatch(this: *Expect, globalThis: *JSGlobalObject, callFrame: *CallFrame if (expected_value.isString()) { break :brk value.stringIncludes(globalThis, expected_value); } else if (expected_value.isRegExp()) { - break :brk expected_value.toMatch(globalThis, value); + break :brk try expected_value.toMatch(globalThis, value); } unreachable; }; diff --git a/test/no-validate-exceptions.txt b/test/no-validate-exceptions.txt index dff3f68a5c..9ca358c41c 100644 --- a/test/no-validate-exceptions.txt +++ b/test/no-validate-exceptions.txt @@ -23,7 +23,7 @@ test/js/node/test/parallel/test-require-dot.js test/js/node/test/parallel/test-util-promisify-custom-names.mjs test/js/node/test/parallel/test-whatwg-readablestream.mjs test/js/node/test/parallel/test-worker.mjs -test/js/node/test/system-ca/test-native-root-certs.test.mjs +test/js/node/test/system-ca/test-native-root-certs.test.mjs test/js/node/events/event-emitter.test.ts test/js/node/module/node-module-module.test.js test/js/node/process/call-constructor.test.js @@ -44,6 +44,11 @@ test/js/node/test/parallel/test-vm-module-referrer-realm.mjs test/js/bun/resolve/resolve.test.ts test/cli/install/bunx.test.ts test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js +test/integration/vite-build/vite-build.test.ts +test/bundler/esbuild/default.test.ts +test/cli/install/bun-repl.test.ts +test/js/third_party/astro/astro-post.test.js +test/regression/issue/ctrl-c.test.ts # trips asan on my macos test machine test/js/node/test/parallel/test-fs-watch.js @@ -139,14 +144,3 @@ vendor/elysia/test/core/dynamic.test.ts vendor/elysia/test/lifecycle/error.test.ts vendor/elysia/test/validator/body.test.ts vendor/elysia/test/ws/message.test.ts - - -test/regression/issue/ctrl-c.test.ts -test/cli/install/bun-run.test.ts -test/js/node/http2/node-http2.test.js -test/js/third_party/astro/astro-post.test.js -test/cli/hot/hot.test.ts -test/cli/install/bun-repl.test.ts -test/bundler/esbuild/default.test.ts -test/integration/vite-build/vite-build.test.ts -test/cli/inspect/HTTPServerAgent.test.ts diff --git a/test/no-validate-leaksan.txt b/test/no-validate-leaksan.txt index 5e554e6d2b..a73c6e3ebf 100644 --- a/test/no-validate-leaksan.txt +++ b/test/no-validate-leaksan.txt @@ -55,6 +55,7 @@ test/js/node/test/parallel/test-worker-terminate-nested.js test/js/node/test/parallel/test-worker-terminate-null-handler.js test/js/node/test/parallel/test-worker-terminate-timers.js test/js/node/test/parallel/test-worker-type-check.js +test/js/node/test/parallel/test-worker-uncaught-exception-async.js test/js/node/test/parallel/test-worker-unref-from-message-during-exit.js test/js/node/test/parallel/test-worker-workerdata-sharedarraybuffer.js test/js/node/test/parallel/test-worker.js @@ -189,6 +190,7 @@ test/js/bun/util/heap-snapshot.test.ts test/regression/issue/02499/02499.test.ts test/js/node/test/parallel/test-http-server-stale-close.js test/js/third_party/comlink/comlink.test.ts +test/regression/issue/22635/22635.test.ts # Bun::JSNodeHTTPServerSocket::clearSocketData