summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-15 20:52:21 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-15 23:46:53 +0100
commit568296d0cc9016c8eefa7dd83ace616514ce261a (patch)
tree7f40a79056b3a6cf48960397bd652766b33d455a /Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
parent33679a8445bbfbb0525ff45741e0f379ddca6c29 (diff)
downloadserenity-568296d0cc9016c8eefa7dd83ace616514ce261a.zip
LibJS: Use ThrowCompletionOr in require_object_coercible()
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
index c7dbdcab68..cc389b5834 100644
--- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp
@@ -149,9 +149,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of)
auto proto = vm.argument(1);
// 1. Set O to ? RequireObjectCoercible(O).
- auto object = require_object_coercible(global_object, vm.argument(0));
- if (vm.exception())
- return {};
+ auto object = TRY_OR_DISCARD(require_object_coercible(global_object, vm.argument(0)));
// 2. If Type(proto) is neither Object nor Null, throw a TypeError exception.
if (!proto.is_object() && !proto.is_null()) {
@@ -242,9 +240,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::freeze)
// 20.1.2.7 Object.fromEntries ( iterable ), https://tc39.es/ecma262/#sec-object.fromentries
JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries)
{
- auto iterable = require_object_coercible(global_object, vm.argument(0));
- if (vm.exception())
- return {};
+ auto iterable = TRY_OR_DISCARD(require_object_coercible(global_object, vm.argument(0)));
auto* object = Object::create(global_object, global_object.object_prototype());