Skip to content

Commit

Permalink
LibJS: Use the GetFunctionRealm abstract-op in ArraySpeciesCreate
Browse files Browse the repository at this point in the history
  • Loading branch information
IdanHo authored and linusg committed Jun 30, 2021
1 parent c254e4c commit dfed8f6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,12 @@ static Object* array_species_create(GlobalObject& global_object, Object& origina
return {};
if (constructor.is_constructor()) {
auto& constructor_function = constructor.as_function();
if (&constructor_function.global_object() != &global_object) {
auto* array_constructor = constructor_function.global_object().array_constructor();
if (&constructor_function == array_constructor) {
auto* constructor_realm = get_function_realm(global_object, constructor_function);
if (vm.exception())
return {};
if (constructor_realm != &global_object) {
if (&constructor_function == constructor_realm->array_constructor())
constructor = js_undefined();
}
}
}

Expand Down

0 comments on commit dfed8f6

Please sign in to comment.