diff --git a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h index e353ae36efa..e20fccce481 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorTypes.h +++ b/Userland/Libraries/LibJS/Runtime/ErrorTypes.h @@ -128,7 +128,6 @@ M(ProxySetPrototypeOfNonExtensible, "Proxy handler's setPrototypeOf trap violates " \ "invariant: the argument must match the prototype of the target if the " \ "target is non-extensible") \ - M(ProxyTwoArguments, "Proxy constructor requires at least two arguments") \ M(ReduceNoInitial, "Reduce of empty array with no initial value") \ M(ReferenceNullishDeleteProperty, "Cannot delete property '{}' of {}") \ M(ReferenceNullishGetProperty, "Cannot get property '{}' of {}") \ diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index f0e53ca3373..7c8b17e704b 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -38,11 +38,6 @@ Value ProxyConstructor::call() Value ProxyConstructor::construct(Function&) { auto& vm = this->vm(); - if (vm.argument_count() < 2) { - vm.throw_exception(global_object(), ErrorType::ProxyTwoArguments); - return {}; - } - auto target = vm.argument(0); auto handler = vm.argument(1); diff --git a/Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js b/Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js index 9e336c26949..0582db348e4 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.js @@ -7,11 +7,17 @@ test("constructs properly", () => { test("constructor argument count", () => { expect(() => { new Proxy(); - }).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments"); + }).toThrowWithMessage( + TypeError, + "Expected target argument of Proxy constructor to be object, got undefined" + ); expect(() => { new Proxy({}); - }).toThrowWithMessage(TypeError, "Proxy constructor requires at least two arguments"); + }).toThrowWithMessage( + TypeError, + "Expected handler argument of Proxy constructor to be object, got undefined" + ); }); test("constructor requires objects", () => {