From 29dd9d75ef065be487f29c70ce4d4434f6228f73 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 19 Feb 2022 17:56:46 +0200 Subject: [PATCH] LibJS: Do not create a prototype property on AsyncFunction instances --- .../Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 17423a6cae..9a87240295 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -127,7 +127,10 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object) // FIXME: Add the AsyncGeneratorObject and set it as prototype. break; } - define_direct_property(vm.names.prototype, prototype, Attribute::Writable); + // 27.7.4 AsyncFunction Instances, https://tc39.es/ecma262/#sec-async-function-instances + // AsyncFunction instances do not have a prototype property as they are not constructible. + if (m_kind != FunctionKind::Async) + define_direct_property(vm.names.prototype, prototype, Attribute::Writable); } }