From d467fd89ffc7c8ef103b611dc1828c7196ddf83a Mon Sep 17 00:00:00 2001 From: Sy Brand Date: Wed, 21 Oct 2026 12:40:52 +0100 Subject: [PATCH 1/2] fix: Correct URL finalizer for when the URL is undefined --- builtins/web/url.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/builtins/web/url.cpp b/builtins/web/url.cpp index 9298be27..18443fa7 100644 --- a/builtins/web/url.cpp +++ b/builtins/web/url.cpp @@ -806,8 +806,11 @@ JSObject *URL::create(JSContext *cx, JS::HandleObject self, JS::HandleValue url_ } void URL::finalize(JS::GCContext *gcx, JSObject *self) { - auto *url = - static_cast(JS::GetReservedSlot(self, std::to_underlying(Slots::Url)).toPrivate()); + auto url_val = JS::GetReservedSlot(self, std::to_underlying(Slots::Url)); + if (url_val.isUndefined()) + return; + + auto *url = static_cast(url_val.toPrivate()); jsurl::free_jsurl(url); } From 6f09bf296322551a8be1e45fdfa56f3870c4a394 Mon Sep 17 00:00:00 2001 From: Sy Brand Date: Wed, 21 Oct 2026 14:57:31 +0100 Subject: [PATCH 2/2] add missing braces --- builtins/web/url.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtins/web/url.cpp b/builtins/web/url.cpp index 18443fa7..c1578aa2 100644 --- a/builtins/web/url.cpp +++ b/builtins/web/url.cpp @@ -807,8 +807,9 @@ JSObject *URL::create(JSContext *cx, JS::HandleObject self, JS::HandleValue url_ void URL::finalize(JS::GCContext *gcx, JSObject *self) { auto url_val = JS::GetReservedSlot(self, std::to_underlying(Slots::Url)); - if (url_val.isUndefined()) + if (url_val.isUndefined()) { return; + } auto *url = static_cast(url_val.toPrivate()); jsurl::free_jsurl(url);