From 4bf88436cbfa920678b9d7ce9669f1cdedfc7064 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 10 Oct 2021 02:55:19 +0200 Subject: LibWeb: Handle JS exceptions slightly sooner in CSS.escape() --- Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp index d43e86aed7..2ca4d6f42a 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp +++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp @@ -38,11 +38,11 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::escape) return {}; } - String result = Web::CSS::serialize_an_identifier(vm.argument(0).to_string(global_object)); + auto identifier = vm.argument(0).to_string(global_object); if (vm.exception()) return {}; - return JS::Value(JS::js_string(vm, result)); + return JS::js_string(vm, Web::CSS::serialize_an_identifier(identifier)); } // https://www.w3.org/TR/css-conditional-3/#dom-css-supports -- cgit v1.2.3