From 26294a2d273f1a65e328b5186e8d6f7fc550b59a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 17 Dec 2021 14:42:24 -0500 Subject: [PATCH] LibJS: Convert a RegExp throw_exception to throw_completion RegExpExec already returns a ThrowCompletionOr so this potentional error should be a completion. RegExp.prototype [ @@replace ] is tripped up by this mistake when implemented closer to the spec. --- Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 4b091e585e..c5bf50f21b 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -257,7 +257,7 @@ ThrowCompletionOr regexp_exec(GlobalObject& global_object, Object& regexp auto result = TRY(vm.call(exec.as_function(), ®exp_object, js_string(vm, move(string)))); if (!result.is_object() && !result.is_null()) - vm.throw_exception(global_object, ErrorType::NotAnObjectOrNull, result.to_string_without_side_effects()); + return vm.throw_completion(global_object, ErrorType::NotAnObjectOrNull, result.to_string_without_side_effects()); return result; }