From 0cf04d07aa6da1399f1c847453e1bfd815fe4dc2 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 24 Apr 2021 17:59:28 +0200 Subject: [PATCH] LibJS: Temporarily clear exception in Object::get_without_side_effects() This would return an empty value once it hits an exception check otherwise. Considering that this mostly is used in situations where we already *do* have an exception (traceback printing, for example), let's make this easier for ourselves to use. --- Userland/Libraries/LibJS/Runtime/Object.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index d89bfc4200..83a7ebe830 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include namespace JS { @@ -789,6 +790,7 @@ Value Object::get(const PropertyName& property_name, Value receiver, bool withou Value Object::get_without_side_effects(const PropertyName& property_name) const { + TemporaryClearException clear_exception(vm()); return get(property_name, {}, true); }