summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-05-05 09:05:52 +0200
committerLinus Groh <mail@linusgroh.de>2022-05-05 22:40:57 +0200
commit09e263dd9c6544037ab44cf0523d23d6d2999b1d (patch)
treed654ee74b0c7a3db13f2afc9184decbee8d0075d /Userland/Libraries/LibJS/Runtime
parentdd547c3374d92607d6da90a78e3d39fb17fc32b0 (diff)
downloadserenity-09e263dd9c6544037ab44cf0523d23d6d2999b1d.zip
LibJS: Fix "prototype" property of generator functions, again
The change in 3ec0183 wasn't actually correct, the spec tells us to set the "prototype" property of the function (created with a prototype of %GeneratorFunction.prototype% itself) to a newly created object: OrdinaryObjectCreate(%GeneratorFunction.prototype.prototype%)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r--Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
index 3f432ee052..0ba0eae4c9 100644
--- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp
@@ -120,7 +120,7 @@ void ECMAScriptFunctionObject::initialize(GlobalObject& global_object)
break;
case FunctionKind::Generator:
// prototype is "g1.prototype" in figure-2 (https://tc39.es/ecma262/img/figure-2.png)
- prototype = global_object.generator_prototype();
+ prototype = Object::create(global_object, global_object.generator_function_prototype_prototype());
break;
case FunctionKind::Async:
break;