diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-06-12 20:03:10 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-12 18:39:23 +0100 |
commit | a2da3f97eff59dd6778de085b7d4d7d7ea0f250a (patch) | |
tree | b829f06de85fcd7aa2436b1404888065bb6dfd7d /Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp | |
parent | b9d4dd685022d11d1567f82e0b69333b0e2b3576 (diff) | |
download | serenity-a2da3f97eff59dd6778de085b7d4d7d7ea0f250a.zip |
LibJS: Remove argument count checks in Object.* methods
These are inconsistent with the specification.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 72a4e19836..b2d1c81435 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -68,8 +68,6 @@ Value ObjectConstructor::construct(Function&) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names) { - if (!vm.argument_count()) - return {}; auto* object = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; @@ -78,8 +76,6 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_names) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of) { - if (!vm.argument_count()) - return {}; auto* object = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; @@ -88,10 +84,6 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_prototype_of) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::set_prototype_of) { - if (vm.argument_count() < 2) { - vm.throw_exception<TypeError>(global_object, ErrorType::ObjectSetPrototypeOfTwoArgs); - return {}; - } auto* object = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; @@ -247,11 +239,6 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::is) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys) { - if (!vm.argument_count()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ConvertUndefinedToObject); - return {}; - } - auto* obj_arg = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; @@ -261,10 +248,6 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::keys) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values) { - if (!vm.argument_count()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ConvertUndefinedToObject); - return {}; - } auto* obj_arg = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; @@ -274,10 +257,6 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::values) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::entries) { - if (!vm.argument_count()) { - vm.throw_exception<TypeError>(global_object, ErrorType::ConvertUndefinedToObject); - return {}; - } auto* obj_arg = vm.argument(0).to_object(global_object); if (vm.exception()) return {}; |